diff --git a/bin/configs/java-jersey2-8.yaml b/bin/configs/java-jersey2-8.yaml index ca0452d33e3..e4407a08260 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 6dee333c835..3d958f01256 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 1a6d6369a0a..b88e0c71616 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 816f4f2228a..4f9bec72aad 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 f6230e40289..09a2488aef6 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 class JavaClientCodegen extends AbstractJavaCodegen 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 class JavaClientCodegen extends AbstractJavaCodegen 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 a00c6dc45f3..6a26f2d8d8b 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 9a5b9bcd03a..f744eec139e 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 @@ -173,7 +173,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 03c44a8ed81..7d3e50fe12d 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 @@ -34,7 +34,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 97cee639466..8ed57947358 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 @@ -32,7 +32,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 97cee639466..8ed57947358 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 @@ -32,7 +32,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 813bb794031..496e5a1a8c7 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 @@ -30,7 +30,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 8919eda30e9..3d875d66b6b 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 14b1af4af5e..8af468cfb4c 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 @@ -125,7 +125,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 b572830482d..e4097fc85c4 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 @@ -20,7 +20,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 525fe5d1377..697e398e463 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 @@ -32,7 +32,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 6607107abf0..1a90c571b7b 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 @@ -81,7 +81,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 9072a8859b4..ce696128e6d 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 @@ -143,7 +143,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 1e3446d106f..f02be9dd0ca 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 class JavaClientCodegenTest { 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 46e2bb8cf32..c98aebcacdd 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 @@ -34,7 +34,7 @@ public class 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 78f0478f2e0..e9a4957326d 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 @@ -36,7 +36,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, 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 78f0478f2e0..e9a4957326d 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 @@ -36,7 +36,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, 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 3e52036c841..35114751c43 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 @@ -36,7 +36,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, 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 3e52036c841..35114751c43 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 @@ -36,7 +36,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, 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 7feb54b93b1..cb482d6d3bb 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 @@ -34,7 +34,7 @@ public class 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 13d479c45c0..415fde77220 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 @@ -34,7 +34,7 @@ public class 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 7feb54b93b1..cb482d6d3bb 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 @@ -34,7 +34,7 @@ public class 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 49957ad16db..c0d0f3b0863 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 @@ -35,7 +35,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, 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 0fa1ee0947c..dce03e0e555 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 @@ -36,7 +36,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, 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 e2c5e2c1ef4..98a7501083c 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 @@ -36,7 +36,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, 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 e2c5e2c1ef4..98a7501083c 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 @@ -36,7 +36,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, false) .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)