-
Notifications
You must be signed in to change notification settings - Fork 1
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
fixes to unknown field handling #113
Conversation
Unknown field handling prevents overwriting unknown fields with their default value, as can be problematic for example with TTL. - add it to resource plugin - make it apply only to spec
var ( | ||
name string | ||
ok bool | ||
spec any | ||
) | ||
switch x := un.(type) { | ||
case map[string]any: | ||
name, ok = x["name"].(string) | ||
spec = x["spec"] | ||
default: | ||
} | ||
if !ok { | ||
return nil, errors.New("missing name or spec fields") | ||
} | ||
d, err := json.Marshal(spec) |
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 we place this logic into a function? (and call it from resourceplugin
, routegroup
and sandbox
)
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.
sure, done.
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.
LGTM
Unknown field handling prevents overwriting unknown fields with their default value, as can be problematic for example with TTL.