Skip to content

Comments

Strict YAML parsing#6652

Merged
pgporada merged 10 commits intomainfrom
strict-yaml-parsing
Feb 22, 2023
Merged

Strict YAML parsing#6652
pgporada merged 10 commits intomainfrom
strict-yaml-parsing

Conversation

@pgporada
Copy link
Member

@pgporada pgporada commented Feb 10, 2023

Adds a custom YAML unmarshaller in the //strictyaml package based on go-yaml/yaml v3 with unique key detection enabled and ensures that target struct is able to contain all target fields.

Fixes #3344.

Copy link
Contributor

@aarongable aarongable left a comment

Choose a reason for hiding this comment

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

This seems like a good approach to me! In general, I have some slight trepidation about adding dependencies on //cmd/shell.go to so many packages outside //cmd/. We already do this in a few places (largely //observer/ and tests, but also a couple others), so it's probably fine. Just worth thinking critically about.

@jsha
Copy link
Contributor

jsha commented Feb 13, 2023

I would recommend putting this in its own small package at the top level: //strictyaml/. Then the function can be strictyaml.Unmarshal. Packages are free!

@pgporada pgporada marked this pull request as ready for review February 13, 2023 23:26
@pgporada pgporada requested a review from a team as a code owner February 13, 2023 23:26
jsha
jsha previously approved these changes Feb 13, 2023
aarongable
aarongable previously approved these changes Feb 14, 2023
Copy link
Contributor

@aarongable aarongable left a comment

Choose a reason for hiding this comment

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

LGTM, with a comment about taking this a step further.

@pgporada
Copy link
Member Author

pgporada commented Feb 14, 2023 via email

@pgporada pgporada dismissed stale reviews from aarongable and jsha via e80d8cb February 14, 2023 01:15
@pgporada pgporada requested review from aarongable and jsha February 14, 2023 01:25
@pgporada pgporada dismissed beautifulentropy’s stale review February 15, 2023 22:26

I believe I have addressed this comment.

Copy link
Member

@beautifulentropy beautifulentropy left a comment

Choose a reason for hiding this comment

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

Looking good. I think we're super close on this.

@pgporada pgporada merged commit d3845f2 into main Feb 22, 2023
@pgporada pgporada deleted the strict-yaml-parsing branch February 22, 2023 19:56
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.

Enable strict mode when parsing yaml

4 participants