OpenAPITools / OpenAPITools/openapi-generator
[REQ] [Java] Add JsonIgnoreProperties to model
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or generator entry points. Start by locating the Java model-generation path and its existing configuration flags, then trace how generated models and their tests are defined; done means the annotation is added by default, the opt-out flag works, and existing generation behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100