-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable FAIL_ON_UNKNOWN_PROPERTIES in generated JSON.java? #10306
Comments
Can you try the following option by setting it to
|
|
We ran into this as well. We "fixed" it with <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<configuration>
<target>
<replace token="mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)"
value="mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)"
dir="target/generated-sources/openapi">
<include name="**/our_generated_client/invoker/JSON.java"/>
</replace>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin> |
This isnt really a fix, any way to force this annotation to be generated in the source code? |
I'm setting this to workaround the issue:
Here is an example: |
I can confirm that works. |
It works until the the generated code also include |
Description
I get com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException because the API I am using has a new field.
But I want my client to be able to just ignore unknown properties.
In a previous project I used openapi generator 4.3.1 and this was the behaviour.
However in newer versions like 5.1.1 or 5.2.1 this doesn't work anymore. I can see that in the generated invoker.JSON.java the FAIL_ON_UNKNOWN_PROPERTIES changed from false to true.
How can I configure the openapi generator, to ignore unknown properties, like it was before?
openapi-generator version
Worked in 4.3.1. Not anymore in 5.x
The text was updated successfully, but these errors were encountered: