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

upgrade to yaml.v3 #1148

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

upgrade to yaml.v3 #1148

wants to merge 9 commits into from

Conversation

wadey
Copy link
Member

@wadey wadey commented May 22, 2024

The main nice fix here is that maps unmarshal into map[string]any
instead of map[any]any, so it cleans things up a bit.

The only gotcha I see for our uses is that the Yaml 1.1 bool types like yes won't automatically be set as a bool inside of map[string]any. So I added a little helper config.AsBool to keep backwards compat there.

wadey added 2 commits May 20, 2024 22:09
The main nice fix here is that maps unmarshal into `map[string]any`
instead of `map[any]any`, so it cleans things up a bit.
Since yaml.v3 doesn't automatically convert yes to bool now, for
backwards compat
@wadey wadey changed the title Yaml v3 upgrade to yaml.v3 May 22, 2024
@wadey wadey added this to the v1.10.0 milestone May 22, 2024
case bool:
return x, true
case string:
switch x {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for Yes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not, let me see what yaml.v2 did for this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this is what they are doing in v3 if you unmarshal into a Bool:

So we can probably copy that.

This is what v2 did:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although if you look above this file at the existing config.GetBool it only allowed the lowercase versions. So we might want to match that for backwards compat. This new config.AsBool is only used for allow_list entries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

2 participants