diff --git a/bin/configs/java-jersey2-8.yaml b/bin/configs/java-jersey2-8.yaml
index ca0452d33e3e..e4407a08260b 100644
--- a/bin/configs/java-jersey2-8.yaml
+++ b/bin/configs/java-jersey2-8.yaml
@@ -11,3 +11,4 @@ additionalProperties:
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
gradleProperties: "\n# JVM arguments\norg.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m\n# set timeout\norg.gradle.daemon.idletimeout=3600000\n# show all warnings\norg.gradle.warning.mode=all"
+ failOnUnknownProperties: true
\ No newline at end of file
diff --git a/bin/configs/java-jersey3.yaml b/bin/configs/java-jersey3.yaml
index 6dee333c835f..3d958f012564 100644
--- a/bin/configs/java-jersey3.yaml
+++ b/bin/configs/java-jersey3.yaml
@@ -12,3 +12,4 @@ additionalProperties:
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
gradleProperties: "\n# JVM arguments\norg.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m\n# set timeout\norg.gradle.daemon.idletimeout=3600000\n# show all warnings\norg.gradle.warning.mode=all"
+ failOnUnknownProperties: true
\ No newline at end of file
diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md
index 1a6d6369a0a6..b88e0c716164 100644
--- a/docs/generators/java-microprofile.md
+++ b/docs/generators/java-microprofile.md
@@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
- **false**
- No changes to the enum's are made, this is the default option.
- **true**
- With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false|
|errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null|
+|failOnUnknownProperties|Fail Jackson de-serialization on unknown properties| |false|
|generateBuilders|Whether to generate builders for models| |false|
|generateClientAsBean|For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
diff --git a/docs/generators/java.md b/docs/generators/java.md
index 816f4f2228a6..4f9bec72aad5 100644
--- a/docs/generators/java.md
+++ b/docs/generators/java.md
@@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|- **false**
- No changes to the enum's are made, this is the default option.
- **true**
- With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false|
|errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null|
+|failOnUnknownProperties|Fail Jackson de-serialization on unknown properties| |false|
|generateBuilders|Whether to generate builders for models| |false|
|generateClientAsBean|For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
index 397b41b17418..4c3df806b7f1 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
@@ -100,6 +100,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String MICROPROFILE_KUMULUZEE = "kumuluzee";
public static final String WEBCLIENT_BLOCKING_OPERATIONS = "webclientBlockingOperations";
public static final String USE_ENUM_CASE_INSENSITIVE = "useEnumCaseInsensitive";
+ public static final String FAIL_ON_UNKNOWN_PROPERTIES = "failOnUnknownProperties";
public static final String SERIALIZATION_LIBRARY_GSON = "gson";
public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson";
@@ -134,6 +135,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
@Setter protected boolean withAWSV4Signature = false;
@Setter protected String gradleProperties;
@Setter protected String errorObjectType;
+ @Getter @Setter protected boolean failOnUnknownProperties = false;
protected String authFolder;
/**
* Serialization library.
@@ -240,6 +242,7 @@ public JavaClientCodegen() {
cliOptions.add(CliOption.newBoolean(GENERATE_CLIENT_AS_BEAN, "For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).", this.generateClientAsBean));
cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries."));
cliOptions.add(CliOption.newBoolean(USE_ENUM_CASE_INSENSITIVE, "Use `equalsIgnoreCase` when String for enum comparison", useEnumCaseInsensitive));
+ cliOptions.add(CliOption.newBoolean(FAIL_ON_UNKNOWN_PROPERTIES, "Fail Jackson de-serialization on unknown properties", this.failOnUnknownProperties));
supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1");
supportedLibraries.put(JERSEY3, "HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1");
@@ -390,6 +393,7 @@ public void processOpts() {
convertPropertyToStringAndWriteBack(GRADLE_PROPERTIES, this::setGradleProperties);
convertPropertyToStringAndWriteBack(ERROR_OBJECT_TYPE, this::setErrorObjectType);
convertPropertyToBooleanAndWriteBack(WEBCLIENT_BLOCKING_OPERATIONS, op -> webclientBlockingOperations=op);
+ convertPropertyToBooleanAndWriteBack(FAIL_ON_UNKNOWN_PROPERTIES, this::setFailOnUnknownProperties);
// add URL query deepObject support to native, apache-httpclient by default
if (!additionalProperties.containsKey(SUPPORT_URL_QUERY)) {
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache
index a00c6dc45f3f..6a26f2d8d8b4 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache
@@ -137,7 +137,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
public ApiClient(CloseableHttpClient httpClient) {
objectMapper = new ObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}});
objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache
index a2f52dbc5cca..680b2a5783fe 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache
@@ -171,7 +171,12 @@ public class ApiClient {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
+ {{#failOnUnknownProperties}}
+ objectMapper.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+ {{/failOnUnknownProperties}}
+ {{^failOnUnknownProperties}}
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+ {{/failOnUnknownProperties}}
objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE);
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.setDateFormat(new RFC3339DateFormat());
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/ApiClient.mustache
index c1b8e1fdd35b..9cf61ebd2427 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/ApiClient.mustache
@@ -32,7 +32,12 @@ public class ApiClient {
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
private static ObjectMapper createDefaultObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper()
+ {{#failOnUnknownProperties}}
+ .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ {{/failOnUnknownProperties}}
+ {{^failOnUnknownProperties}}
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ {{/failOnUnknownProperties}}
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.setDateFormat(new RFC3339DateFormat());
{{#joda}}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache
index a7c61bac316e..c4a6cfd89193 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache
@@ -30,7 +30,7 @@ public class JSON implements ContextResolver {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}})
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache
index a7c61bac316e..c4a6cfd89193 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache
@@ -30,7 +30,7 @@ public class JSON implements ContextResolver {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}})
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache
index 7a0951095059..a85fa4dd37e5 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache
@@ -28,7 +28,12 @@ public class JSON {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
+ {{#failOnUnknownProperties}}
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ {{/failOnUnknownProperties}}
+ {{^failOnUnknownProperties}}
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ {{/failOnUnknownProperties}}
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/JacksonObjectMapper.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/JacksonObjectMapper.mustache
index 8919eda30e94..3d875d66b6bc 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/JacksonObjectMapper.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/JacksonObjectMapper.mustache
@@ -27,7 +27,7 @@ public class JacksonObjectMapper extends Jackson2Mapper {
ObjectMapper mapper = new ObjectMapper();
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}});
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache
index 416e5ea895a5..11591ba8fdd3 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache
@@ -123,7 +123,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
ObjectMapper mapper = new ObjectMapper();
mapper.setDateFormat(dateFormat);
mapper.registerModule(new JavaTimeModule());
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}});
{{#openApiNullable}}
JsonNullableModule jnm = new JsonNullableModule();
mapper.registerModule(jnm);
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/JSON.mustache
index 903a004e787f..f38b693c1d5c 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/JSON.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/JSON.mustache
@@ -18,7 +18,7 @@ public class JSON implements ContextResolver {
public JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}});
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON_jackson.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON_jackson.mustache
index 25287dcf7f13..414f4ca21de7 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON_jackson.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON_jackson.mustache
@@ -30,7 +30,7 @@ public class JSON implements ContextResolver {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}})
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache
index f0df804e264c..d257b5dc7542 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache
@@ -79,7 +79,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// Build object mapper
this.objectMapper = new ObjectMapper();
this.objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}});
this.objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
this.objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
this.objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache
index ef13e46a42c4..f6fd058f3c30 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache
@@ -141,7 +141,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
ObjectMapper mapper = new ObjectMapper();
mapper.setDateFormat(dateFormat);
mapper.registerModule(new JavaTimeModule());
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, {{failOnUnknownProperties}});
{{#openApiNullable}}
JsonNullableModule jnm = new JsonNullableModule();
mapper.registerModule(jnm);
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java
index a16014271aa5..9225641d3a85 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java
@@ -244,6 +244,21 @@ public void testSettersForConfigValues() throws Exception {
Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON); // the library JavaClientCodegen.OKHTTP_GSON only supports GSON
}
+ @Test
+ public void testFailOnUnknownPropertiesAdditionalProperty() {
+ final JavaClientCodegen codegen = new JavaClientCodegen();
+
+ codegen.processOpts();
+
+ ConfigAssert configAssert = new ConfigAssert(codegen.additionalProperties());
+ configAssert.assertValue(JavaClientCodegen.FAIL_ON_UNKNOWN_PROPERTIES, codegen::isFailOnUnknownProperties, Boolean.FALSE);
+
+ codegen.additionalProperties().put(JavaClientCodegen.FAIL_ON_UNKNOWN_PROPERTIES, true);
+ codegen.processOpts();
+
+ configAssert.assertValue(JavaClientCodegen.FAIL_ON_UNKNOWN_PROPERTIES, codegen::isFailOnUnknownProperties, Boolean.TRUE);
+ }
+
@Test
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
final JavaClientCodegen codegen = new JavaClientCodegen();
diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java
index 0458983c0a2c..1feb08d4ce4f 100644
--- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/JSON.java
@@ -21,7 +21,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java
index 0458983c0a2c..1feb08d4ce4f 100644
--- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java
@@ -21,7 +21,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/JSON.java
index 7dbe284f09a1..af343ae7c799 100644
--- a/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/petstore/java/native-jakarta/src/main/java/org/openapitools/client/JSON.java
@@ -21,7 +21,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java
index 0458983c0a2c..1feb08d4ce4f 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java
@@ -21,7 +21,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java
index 0aeb91f99654..ebe7ed95282d 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java
@@ -22,7 +22,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/JSON.java
index a17316c3de29..543741c20100 100644
--- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/JSON.java
@@ -23,7 +23,7 @@ public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
- .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)