Log more info when validation fails due to unexpected fields on a resource
blaivs opened this issue · 4 comments
What would you like to be added?
When validating a resource, if there's, let's say a typo on a property, the validation results in an error where no reference to the resource that failed to validate is logged. When validating a file with several resources in it, it's hard to find which to find which one errored.
Example:
apiVersion: v1
kind: ConfigMap
metadata:
name: x.com
datas: # extra "s"
key: value
Error message: datas: Invalid value: value provided for unknown field
So no reference to name and kind of the resource.
This happens as when resource parsing fails, it errors without parsing metadata's name. Group and kind are returned but not attached to the error.
Feels like getting this basic info on the resource could be done at parse function?
Why is this needed?
It will help identifying the resource that caused the error.
I agree parse errors should be accumulated and linked back to the original object. Attributing only to file makes it hard to reason about large yamls with many documents
/assign
unassigned myself because I'm having a bit of trouble setting up my environment and don't want to block development. I'll try a good first issue when I'm set up. :)
/assign