Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.42.1: unfortunate change in the yqlib.NewYamlEncoder( ) API #1964

Closed
rudo-thomas opened this issue Mar 5, 2024 · 4 comments
Closed

v4.42.1: unfortunate change in the yqlib.NewYamlEncoder( ) API #1964

rudo-thomas opened this issue Mar 5, 2024 · 4 comments
Labels

Comments

@rudo-thomas
Copy link

rudo-thomas commented Mar 5, 2024

Describe the bug
Two problems I see with the v4.42.1 version of yqlib:

  • coming from v4.41.1, the yqlib.NewYamlEncoder function changed its parameters
    • while cleaner, this is quite unfortunate in a minor release because it breaks user code
  • the new function no longer takes indent and colorise, these are now in the passed YamlPreferences
    • however, the NewDefaultYamlPreferences have the coloring turned on -- which means when porting to the new version, extra effort needs to be performed because the defaults don't work (edit: I'm saying "don't work," because with the defaults the encoder is not producing valid YAML, but a "colored YAML")

Version of yq: 4.42.1

Expected behavior

  • No API breakage in minor versions.
  • When user code needs to be changed, the defaults should be more user-friendly.
@rudo-thomas
Copy link
Author

Just to clarify: The actual fix on the user code side is trivial, it's just it is surprising it had to be done, and that the default was not working well because of the coloring.

@rudo-thomas rudo-thomas changed the title v4.42.1: unfortunate change in the yqlib.NewYamlEncoder( )API v4.42.1: unfortunate change in the yqlib.NewYamlEncoder( ) API Mar 5, 2024
@leviliangtw
Copy link
Contributor

IOM, setting the colorise to be false in default is ideal and intuitive.
If I were a newbie implementing something with yqlib, I would expect a most clean output.
(Same idea for the Json preference)

@mikefarah
Copy link
Owner

Yeah fair call, I'll change the default to false for when using the library.

The semantic versioning atm is for the CLI - and I'd only increment the major version for a breaking CLI interface change.

I really should extract the lib parts to another go package and then that can have its own semantic versioning. Just haven't got around to it sorry!

@mikefarah
Copy link
Owner

Fixed in v4.43.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants