add custom handling of NullFields
to marshaling
#19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another example (alternative to #18), sometimes code samples speak better than words 😅
Only sometimes respect
omitEmpty
, override if it was requested inNullFields
on the model.An example of how a user would opt out of omitting a field on a struct if it's nil can be found in the test.
Adapts implementation from Google's MarshalJSON for GCP APIs: https://github.com/googleapis/google-api-go-client/blob/9345ed052d0e81721fec063f5048a226b73b6829/internal/gensupport/json.go#L14-L50