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

govcd/types with boolean fields and omitempty struct tag may cause incorrect behaviour #223

Open
Didainius opened this issue Jul 29, 2019 · 0 comments

Comments

@Didainius
Copy link
Collaborator

Didainius commented Jul 29, 2019

Having a bool field with omitempty struct tag may cause incorrect behavior for updates.
In short:

If type bool value has omitempty, then having its value as false will not be unmarshaled to XML/JSON and will not be sent in API query.

If the SDK is used for updating settings and had true previously, then the update with false may have no impact on actual settings because field will be skipped in XML/JSON representation after unmarshaling.

This must be clarified and checked for values which are bool type and have omitempty tag.

There are quite a few such fields as it can be checked with:
grep -Rn "bool" types/v56/types.go | grep omitempty

Update. It looks as skipping a field with false value is a problem in proxied NSX API only so far as was proven in #217 (comment)

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

No branches or pull requests

1 participant