Skip to content

[REQ] [Java] Add JsonIgnoreProperties to model #3438

Open
@Fjolnir-Dvorak

Description

@Fjolnir-Dvorak

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

We have the scenario that we have a service with multiple client APIs and a lot of other interfaces for other systems like databases which are also working with json.
The project is using one single JsonMapper for everything. The problem is: The JsonMapper is not iognoring unknown fields per se.

Describe the solution you'd like

To acommodate this issue we are adding the annotation

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)

to each model each time we need to regenerate the API per hand (to be honest, sed, but even sed can be considered a manual intervention).

Would this addition destroy anything? No, the generator provides its own JsonMapper which does exactly the same, but implicit, not explicit. This addition would (in my opinion) add some beautiful flavour of further documentation to each model making it even possible to use your own mapper without any further configuration or intervention.

There will be a new flag to turn off this new feature, but it will be on by default

Pull Request will follow...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions