Skip to content

Differentiating explicit null from default values #680

Open
@Frederick888

Description

@Frederick888

Is your feature request related to a problem? Please describe.

We'd like to use the generated models for a Merge Patch API.

It's similar to https://tools.ietf.org/html/rfc7396, where missing fields in the request payload are left untouched, and explicit null fields are unset.

At the moment there doesn't seem to be a place to track the explicitly null'ed fields and by default they are missing from request payloads.

Describe the solution you'd like

Add a magic map field (e.g. Set<?> changedFields) or a magic boolean field for each actual field (e.g. for someField it can have boolean isSomeFieldChanged) to track changed fields via field mutators, and include these fields in serialisation result even if they are null.

Describe alternatives you've considered

Copy out the generated models and manually do what I described above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions