-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Some collections are not marked as omitempty in their go classes: https://github.com/openshift/api/blob/master/apps/v1/types.go#L63
The java generator will not mark those fields for JsonInclude non_empty.
However our builders are opinionated about treating an empty and null collections the same (in some places), and users will end up with empty collections in their serialized forms without realizing it. This is problematic for merge patches which treat the presense of an empty collection as a full replacement for the existing.
Originally posted by @shawkins in #5222 (comment)
We have two options to evaluate:
-
Just to be consistent make all collections default to non-empty (can be done in either the generator or the jsonschema2pojo logic). This will of course open users up to Patch with empty collections #4606
-
Try to modify the builder logic to differentaite between empty and null based upon the JsonInclude annotation - this seems like a tall order, and probably not viable.