-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add strict yaml unmarshal option #90
Conversation
I think there's errors in some of the test fixtures. That's causing them to not unmarshal in strict mode -- which is why it's good to have this change. |
I looked at what is going on here and this might be a hierarchy problem when doing the unmarshall of the Spec, and this is why when unmarshalling it's not recognizing CheckOutput with
Seems as we are embedding |
The weird thing is, that is a valid field. |
@adamperlin and I had the change to explore this issue a bit more, here is some of the behavior we saw:
Unmarshalling behavior without The observed behavior with One question about the |
Just to add on to what Danny said, if we add an What was the original purpose for embedded |
wrt embedded: I wonder if we can use |
86419e8
to
e3f4947
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change, and I opened #138 to deal with the command stuff.
I think we just should not inline these data types, its too confusing.
load_test.go
Outdated
// NOTE: not using text template yaml for this test | ||
// tabs seem to be illegal in yaml indentation | ||
// yaml unmarshalling with strict mode doesn't produce a great error message. | ||
yaml, err := os.ReadFile("test/fixtures/unmarshall/source-inline.yml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use //go:embed
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you haven't seen that before: https://pkg.go.dev/embed
e3f4947
to
4ad6b31
Compare
This PR adds strict option for yaml unmarshal, any unknow field or typo
field
in a dalec spec will result in errorThis should solve Issue #81
example output when trying to build example with unknow field.