From 4e06221dd9159fd3300a27e2430eb2e17a58a6a2 Mon Sep 17 00:00:00 2001 From: Daniel Nowosielecki Date: Wed, 10 Dec 2025 22:49:15 +0100 Subject: [PATCH 1/6] fix: conditionally add jackson JsonIgnoreProperties for base class polymorphism --- docs/generators/groovy.md | 2 + docs/generators/java-camel.md | 1 + docs/generators/java-dubbo.md | 1 + docs/generators/java-helidon-client.md | 1 + docs/generators/java-helidon-server.md | 1 + docs/generators/java-inflector.md | 1 + docs/generators/java-micronaut-client.md | 1 + docs/generators/java-micronaut-server.md | 1 + docs/generators/java-microprofile.md | 1 + docs/generators/java-msf4j.md | 1 + docs/generators/java-pkmst.md | 1 + docs/generators/java-play-framework.md | 1 + docs/generators/java-undertow-server.md | 1 + docs/generators/java-vertx-web.md | 1 + docs/generators/java-vertx.md | 1 + docs/generators/java-wiremock.md | 1 + docs/generators/java.md | 1 + .../languages/AbstractJavaCodegen.java | 5 ++ .../codegen/languages/JavaClientCodegen.java | 1 + .../Java/typeInfoAnnotation.mustache | 3 + .../codegen/java/AbstractJavaCodegenTest.java | 10 +++ .../codegen/java/JavaClientCodegenTest.java | 54 ++++++++++------ .../test/resources/3_0/java/issue12777.yaml | 64 +++++++++++++++++++ 23 files changed, 137 insertions(+), 18 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/java/issue12777.yaml diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index e2f1314c4bb1..472369c20c70 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -69,6 +69,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| + ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index b50d9b4728c1..d0acb3b19c0c 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -116,6 +116,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useTags|use tags for creating interface and controller classnames| |false| |virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-dubbo.md b/docs/generators/java-dubbo.md index fa64f3d35955..7c6166abc88c 100644 --- a/docs/generators/java-dubbo.md +++ b/docs/generators/java-dubbo.md @@ -82,6 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 5f309c81ce6b..69dfe319c41c 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index b4d8db132743..c3e66a51a57a 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -71,6 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 3adfffad38df..e78a3505aa22 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -71,6 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index 37a2d8907ee1..f0d9fe22c148 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -92,6 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index 4a21268afbd5..b98f2801c745 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -91,6 +91,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 9e02b37145ef..febb0196c6bd 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -109,6 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index 7251308c1440..de17cad14601 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -77,6 +77,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index e2299587c5f2..fe8114316a29 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -78,6 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |zipkinUri|Zipkin URI| |null| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index c5f80ab75d16..917053525665 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -81,6 +81,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useSwaggerUI|Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapCalls|Add a wrapper to each controller function to handle things like metrics, response modification, etc..| |true| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index c258e9aa5df4..775c743f17cc 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -71,6 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 473c40d1af7d..eee80377b90b 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -71,6 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index dd2722079b63..63af107d946d 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -74,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index 39b0a40d6edf..d73221c763c6 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -71,6 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java.md b/docs/generators/java.md index b98c5386e4e5..7e1493938173 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -109,6 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| +|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 35280515e6a5..bcdc7af93539 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -102,6 +102,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String JAVAX_PACKAGE = "javaxPackage"; public static final String USE_JAKARTA_EE = "useJakartaEe"; public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull"; + public static final String DISCRIMINATOR_FIELD_IGNORE = "discriminatorFieldIgnore"; public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign"; public static final String USE_ONE_OF_INTERFACES = "useOneOfInterfaces"; @@ -198,6 +199,8 @@ protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy, original} protected boolean jackson = false; @Getter @Setter protected boolean generateBuilders; + @Getter @Setter + protected boolean discriminatorFieldIgnore = false; /** * useBeanValidation has been moved from child generators to AbstractJavaCodegen. * The reason is that getBeanValidation needs it @@ -345,6 +348,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null")); cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models").defaultValue(Boolean.FALSE.toString())); + cliOptions.add(CliOption.newBoolean(DISCRIMINATOR_FIELD_IGNORE, "Ignore discriminator field allOf, oneOf for Jackson serialization", discriminatorFieldIgnore)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -424,6 +428,7 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, this::setGenerateConstructorWithAllArgs); convertPropertyToBooleanAndWriteBack(GENERATE_BUILDERS, this::setGenerateBuilders); + convertPropertyToBooleanAndWriteBack(DISCRIMINATOR_FIELD_IGNORE, this::setDiscriminatorFieldIgnore); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); 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 c532d93fa99b..ff9b975d1ec1 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 @@ -151,6 +151,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen @Setter protected boolean supportVertxFuture = false; @Setter protected boolean useSealedOneOfInterfaces = false; @Setter protected boolean useUnaryInterceptor = false; + protected String authFolder; /** * Serialization library. diff --git a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache index 58bfed9c45b3..002fea8b1ca4 100644 --- a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache @@ -1,9 +1,12 @@ {{#jackson}} +{{^discriminatorFieldIgnore}} @JsonIgnoreProperties( value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) +{{/discriminatorFieldIgnore}} + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) {{#discriminator.mappedModels}} {{#-first}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java index d0b39ffe9a35..364e186cfc6d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java @@ -46,6 +46,7 @@ import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; +import static org.openapitools.codegen.languages.AbstractJavaCodegen.DISCRIMINATOR_FIELD_IGNORE; public class AbstractJavaCodegenTest { @@ -968,6 +969,15 @@ public void AnnotationsContainerTest() { Assert.assertEquals(defaultValue, "List<@Max(10)Integer>"); } + @Test + public void discriminatorFieldIgnoreFlagTest() { + codegen.additionalProperties().put(DISCRIMINATOR_FIELD_IGNORE, true); + + codegen.preprocessOpenAPI(FLATTENED_SPEC.get("3_0/petstore")); + + Assert.assertTrue((boolean) codegen.additionalProperties().get(DISCRIMINATOR_FIELD_IGNORE)); + } + @Test public void removeAnnotationsTest() { Assert.assertEquals(codegen.removeAnnotations("@Min(0) @Max(10)Integer"), "Integer"); 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 25403631be91..0b23cd7b0f0c 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 @@ -3241,7 +3241,7 @@ public void testRestTemplateWithCustomUserAgent() { .setOutputDir(output.toString().replace("\\", "/")); final Map files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate() - .stream().collect(Collectors.toMap(File::getName, Function.identity()));; + .stream().collect(Collectors.toMap(File::getName, Function.identity())); final JavaFileAssert apiClient = JavaFileAssert.assertThat(files.get("ApiClient.java")) .printFileContent(); @@ -3553,23 +3553,23 @@ public void annotationLibraryDoesNotCauseImportConflicts() throws IOException { output.deleteOnExit(); final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName(JAVA_GENERATOR) - .setLibrary(JavaClientCodegen.NATIVE) - .setAdditionalProperties(properties) - .setInputSpec("src/test/resources/3_0/java/native/issue21991.yaml") - .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.NATIVE) + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/java/native/issue21991.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); Map files = generator.opts(clientOptInput).generate().stream() - .collect(Collectors.toMap(File::getName, Function.identity())); + .collect(Collectors.toMap(File::getName, Function.identity())); File apiFile = files.get("Schema.java"); assertNotNull(apiFile); JavaFileAssert.assertThat(apiFile).fileDoesNotContain( - "import io.swagger.v3.oas.annotations.media.Schema;" + "import io.swagger.v3.oas.annotations.media.Schema;" ); } @@ -3582,23 +3582,23 @@ public void annotationLibraryGeneratesCorrectImports() throws IOException { output.deleteOnExit(); final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName(JAVA_GENERATOR) - .setLibrary(JavaClientCodegen.NATIVE) - .setAdditionalProperties(properties) - .setInputSpec("src/test/resources/3_0/java/native/issue21991.yaml") - .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.NATIVE) + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/java/native/issue21991.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); Map files = generator.opts(clientOptInput).generate().stream() - .collect(Collectors.toMap(File::getName, Function.identity())); + .collect(Collectors.toMap(File::getName, Function.identity())); File apiFile = files.get("Schema.java"); assertNotNull(apiFile); JavaFileAssert.assertThat(apiFile).fileContains( - "import io.swagger.v3.oas.annotations.media.Schema;" + "import io.swagger.v3.oas.annotations.media.Schema;" ); } @@ -3753,7 +3753,7 @@ public void testClassesAreValidJavaOkHttpGson() { JavaFileAssert.assertThat(oneOfFile).fileContains( "final TypeAdapter adaptersomepkgA = gson.getDelegateAdapter(this, TypeToken.get(some.pkg.A.class));", - "final TypeAdapter adaptersomepkgB = gson.getDelegateAdapter(this, TypeToken.get(some.pkg.B.class));", + "final TypeAdapter adaptersomepkgB = gson.getDelegateAdapter(this, TypeToken.get(some.pkg.B.class));", "public some.pkg.A getsomepkgA() throws ClassCastException {", "public some.pkg.B getsomepkgB() throws ClassCastException {" ); @@ -3803,10 +3803,11 @@ public void givenComplexObjectHasDefaultValueWhenGenerateThenDefaultAssignmentsA //chain method calls for object initialization class MethodCallVisitor extends VoidVisitorAdapter { Map expressionMap = new HashMap<>(); + @Override public void visit(MethodCallExpr n, Void arg) { expressionMap.put(n.getNameAsString(), n.getArgument(0)); - if(n.getScope().isPresent()) { + if (n.getScope().isPresent()) { n.getScope().get().accept(this, arg); } } @@ -3993,7 +3994,7 @@ public void queryParameterJsonSerialization(String library) { assertFileContains( output.resolve("src/main/java/org/openapitools/client/api/QueryApi.java"), "queryParams.putAll(apiClient.parameterToMultiValueMapJson(ApiClient.CollectionFormat" + - ".valueOf(\"csv\".toUpperCase(Locale.ROOT)), \"json_serialized_object_array_ref_string_query\", jsonSerializedObjectArrayRefStringQuery));" + ".valueOf(\"csv\".toUpperCase(Locale.ROOT)), \"json_serialized_object_array_ref_string_query\", jsonSerializedObjectArrayRefStringQuery));" ); } @@ -4063,4 +4064,21 @@ public void testOneOfInterfaceWithAnnotation() { .isInterface() .assertTypeAnnotations().containsWithName("SuppressWarnings"); } + + @Test + public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { + final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, + Map.of(DISCRIMINATOR_FIELD_IGNORE, "true")); + JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) + .assertTypeAnnotations().doesNotContainWithName("JsonIgnoreProperties"); + } + + @Test + public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeAdded() { + final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, + Map.of(DISCRIMINATOR_FIELD_IGNORE, "false")); + JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) + .assertTypeAnnotations().containsWithName("JsonIgnoreProperties"); + } + } diff --git a/modules/openapi-generator/src/test/resources/3_0/java/issue12777.yaml b/modules/openapi-generator/src/test/resources/3_0/java/issue12777.yaml new file mode 100644 index 000000000000..6f2299858873 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/java/issue12777.yaml @@ -0,0 +1,64 @@ +openapi: 3.0.1 +info: + title: Example - Polymorphic Config + version: 1.0.0 +paths: { } +components: + schemas: + # ------------------------- + # Base type with discriminator + # ------------------------- + BaseConfiguration: + type: object + properties: + id: + type: integer + format: int64 + type: + $ref: '#/components/schemas/ConfigurationType' + required: + - type + discriminator: + propertyName: type + mapping: + CHILD_ONE: '#/components/schemas/ChildOneConfiguration' + CHILD_TWO: '#/components/schemas/ChildTwoConfiguration' + + ConfigurationType: + type: string + description: Example discriminator enum + enum: + - CHILD_ONE + - CHILD_TWO + + # ------------------------- + # Child 1 + # ------------------------- + ChildOneConfiguration: + allOf: + - $ref: '#/components/schemas/BaseConfiguration' + - type: object + required: + - type + properties: + type: + $ref: '#/components/schemas/ConfigurationType' + additionalFieldOne: + type: string + additionalProperties: true + + # ------------------------- + # Child 2 + # ------------------------- + ChildTwoConfiguration: + allOf: + - $ref: '#/components/schemas/BaseConfiguration' + - type: object + required: + - type + properties: + type: + $ref: '#/components/schemas/ConfigurationType' + additionalFieldTwo: + type: integer + additionalProperties: true From ae04f7ce9e4575c4a79fc257110d18e76ec2f6a4 Mon Sep 17 00:00:00 2001 From: Daniel Nowosielecki Date: Wed, 10 Dec 2025 23:21:38 +0100 Subject: [PATCH 2/6] fix: rename flag --- docs/generators/groovy.md | 2 +- docs/generators/java-camel.md | 2 +- docs/generators/java-dubbo.md | 2 +- docs/generators/java-helidon-client.md | 2 +- docs/generators/java-helidon-server.md | 2 +- docs/generators/java-inflector.md | 2 +- docs/generators/java-micronaut-client.md | 2 +- docs/generators/java-micronaut-server.md | 2 +- docs/generators/java-microprofile.md | 2 +- docs/generators/java-msf4j.md | 2 +- docs/generators/java-pkmst.md | 2 +- docs/generators/java-play-framework.md | 2 +- docs/generators/java-undertow-server.md | 2 +- docs/generators/java-vertx-web.md | 2 +- docs/generators/java-vertx.md | 2 +- docs/generators/java-wiremock.md | 2 +- docs/generators/java.md | 2 +- .../codegen/languages/AbstractJavaCodegen.java | 8 ++++---- .../src/main/resources/Java/typeInfoAnnotation.mustache | 4 ++-- .../codegen/java/AbstractJavaCodegenTest.java | 2 +- .../openapitools/codegen/java/JavaClientCodegenTest.java | 4 ++-- 21 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 472369c20c70..4c3951b997a5 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -69,7 +69,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index d0acb3b19c0c..b51c1cb4a312 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -116,7 +116,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useTags|use tags for creating interface and controller classnames| |false| |virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-dubbo.md b/docs/generators/java-dubbo.md index 7c6166abc88c..f4bf3fdadba7 100644 --- a/docs/generators/java-dubbo.md +++ b/docs/generators/java-dubbo.md @@ -82,7 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 69dfe319c41c..261c45b629e6 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -68,7 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index c3e66a51a57a..fb08abb6065c 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index e78a3505aa22..b62f77b35b48 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index f0d9fe22c148..963e6a1214a1 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -92,7 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index b98f2801c745..16cf16a74ae6 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -91,7 +91,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index febb0196c6bd..203016f8a240 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -109,7 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index de17cad14601..bd68b2dff859 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -77,7 +77,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index fe8114316a29..13bcf1e96da9 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -78,7 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |zipkinUri|Zipkin URI| |null| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 917053525665..6ef4cff72fd0 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -81,7 +81,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useSwaggerUI|Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapCalls|Add a wrapper to each controller function to handle things like metrics, response modification, etc..| |true| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 775c743f17cc..5af53c6aa537 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index eee80377b90b..6e2ae124829b 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 63af107d946d..f39d31a1e4c0 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -74,7 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index d73221c763c6..324f9f6505ea 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java.md b/docs/generators/java.md index 7e1493938173..2eeb07eeb472 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -109,7 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index bcdc7af93539..3081c1a31c11 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -102,7 +102,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String JAVAX_PACKAGE = "javaxPackage"; public static final String USE_JAKARTA_EE = "useJakartaEe"; public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull"; - public static final String DISCRIMINATOR_FIELD_IGNORE = "discriminatorFieldIgnore"; + public static final String DISCRIMINATOR_FIELD_IGNORE = "disableDiscriminatorFieldIgnore"; public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign"; public static final String USE_ONE_OF_INTERFACES = "useOneOfInterfaces"; @@ -200,7 +200,7 @@ protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy, original} @Getter @Setter protected boolean generateBuilders; @Getter @Setter - protected boolean discriminatorFieldIgnore = false; + protected boolean disableDiscriminatorFieldIgnore = false; /** * useBeanValidation has been moved from child generators to AbstractJavaCodegen. * The reason is that getBeanValidation needs it @@ -348,7 +348,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null")); cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models").defaultValue(Boolean.FALSE.toString())); - cliOptions.add(CliOption.newBoolean(DISCRIMINATOR_FIELD_IGNORE, "Ignore discriminator field allOf, oneOf for Jackson serialization", discriminatorFieldIgnore)); + cliOptions.add(CliOption.newBoolean(DISCRIMINATOR_FIELD_IGNORE, "Ignore discriminator field allOf, oneOf for Jackson serialization", disableDiscriminatorFieldIgnore)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -428,7 +428,7 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, this::setGenerateConstructorWithAllArgs); convertPropertyToBooleanAndWriteBack(GENERATE_BUILDERS, this::setGenerateBuilders); - convertPropertyToBooleanAndWriteBack(DISCRIMINATOR_FIELD_IGNORE, this::setDiscriminatorFieldIgnore); + convertPropertyToBooleanAndWriteBack(DISCRIMINATOR_FIELD_IGNORE, this::setDisableDiscriminatorFieldIgnore); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); diff --git a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache index 002fea8b1ca4..a67c6e9aea27 100644 --- a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache @@ -1,11 +1,11 @@ {{#jackson}} -{{^discriminatorFieldIgnore}} +{{^disableDiscriminatorFieldIgnore}} @JsonIgnoreProperties( value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) -{{/discriminatorFieldIgnore}} +{{/disableDiscriminatorFieldIgnore}} @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) {{#discriminator.mappedModels}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java index 364e186cfc6d..8456669aaaa8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java @@ -970,7 +970,7 @@ public void AnnotationsContainerTest() { } @Test - public void discriminatorFieldIgnoreFlagTest() { + public void disableDiscriminatorFieldIgnoreFlagTest() { codegen.additionalProperties().put(DISCRIMINATOR_FIELD_IGNORE, true); codegen.preprocessOpenAPI(FLATTENED_SPEC.get("3_0/petstore")); 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 0b23cd7b0f0c..6de658139915 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 @@ -4066,7 +4066,7 @@ public void testOneOfInterfaceWithAnnotation() { } @Test - public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { + public void disableDiscriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, Map.of(DISCRIMINATOR_FIELD_IGNORE, "true")); JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) @@ -4074,7 +4074,7 @@ public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdd } @Test - public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeAdded() { + public void disableDiscriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeAdded() { final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, Map.of(DISCRIMINATOR_FIELD_IGNORE, "false")); JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) From a819f0cd8245512f215df8e1c8d1cd2463e43518 Mon Sep 17 00:00:00 2001 From: Daniel Nowosielecki Date: Wed, 10 Dec 2025 23:21:38 +0100 Subject: [PATCH 3/6] fix: rename flag --- docs/generators/groovy.md | 2 +- docs/generators/java-camel.md | 2 +- docs/generators/java-dubbo.md | 2 +- docs/generators/java-helidon-client.md | 2 +- docs/generators/java-helidon-server.md | 2 +- docs/generators/java-inflector.md | 2 +- docs/generators/java-micronaut-client.md | 2 +- docs/generators/java-micronaut-server.md | 2 +- docs/generators/java-microprofile.md | 2 +- docs/generators/java-msf4j.md | 2 +- docs/generators/java-pkmst.md | 2 +- docs/generators/java-play-framework.md | 2 +- docs/generators/java-undertow-server.md | 2 +- docs/generators/java-vertx-web.md | 2 +- docs/generators/java-vertx.md | 2 +- docs/generators/java-wiremock.md | 2 +- docs/generators/java.md | 2 +- .../codegen/languages/AbstractJavaCodegen.java | 10 ++++------ .../main/resources/Java/typeInfoAnnotation.mustache | 4 ++-- .../codegen/java/AbstractJavaCodegenTest.java | 8 ++++---- .../codegen/java/JavaClientCodegenTest.java | 8 ++++---- 21 files changed, 31 insertions(+), 33 deletions(-) diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 472369c20c70..4c3951b997a5 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -69,7 +69,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index d0acb3b19c0c..b51c1cb4a312 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -116,7 +116,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useTags|use tags for creating interface and controller classnames| |false| |virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-dubbo.md b/docs/generators/java-dubbo.md index 7c6166abc88c..f4bf3fdadba7 100644 --- a/docs/generators/java-dubbo.md +++ b/docs/generators/java-dubbo.md @@ -82,7 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 69dfe319c41c..261c45b629e6 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -68,7 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index c3e66a51a57a..fb08abb6065c 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index e78a3505aa22..b62f77b35b48 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index f0d9fe22c148..963e6a1214a1 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -92,7 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index b98f2801c745..16cf16a74ae6 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -91,7 +91,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index febb0196c6bd..203016f8a240 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -109,7 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index de17cad14601..bd68b2dff859 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -77,7 +77,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index fe8114316a29..13bcf1e96da9 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -78,7 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |zipkinUri|Zipkin URI| |null| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 917053525665..6ef4cff72fd0 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -81,7 +81,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useSwaggerUI|Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapCalls|Add a wrapper to each controller function to handle things like metrics, response modification, etc..| |true| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 775c743f17cc..5af53c6aa537 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index eee80377b90b..6e2ae124829b 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 63af107d946d..f39d31a1e4c0 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -74,7 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index d73221c763c6..324f9f6505ea 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -71,7 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java.md b/docs/generators/java.md index 7e1493938173..2eeb07eeb472 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -109,7 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|discriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| +|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index bcdc7af93539..13af9699a15e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Strings; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.OpenAPI; @@ -51,7 +50,6 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; -import org.openapitools.codegen.templating.mustache.ReplaceAllLambda; import org.openapitools.codegen.utils.CamelizeOption; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -102,7 +100,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String JAVAX_PACKAGE = "javaxPackage"; public static final String USE_JAKARTA_EE = "useJakartaEe"; public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull"; - public static final String DISCRIMINATOR_FIELD_IGNORE = "discriminatorFieldIgnore"; + public static final String DISABLE_DISCRIMINATOR_FIELD_IGNORE = "disableDiscriminatorFieldIgnore"; public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign"; public static final String USE_ONE_OF_INTERFACES = "useOneOfInterfaces"; @@ -200,7 +198,7 @@ protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy, original} @Getter @Setter protected boolean generateBuilders; @Getter @Setter - protected boolean discriminatorFieldIgnore = false; + protected boolean disableDiscriminatorFieldIgnore = false; /** * useBeanValidation has been moved from child generators to AbstractJavaCodegen. * The reason is that getBeanValidation needs it @@ -348,7 +346,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null")); cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models").defaultValue(Boolean.FALSE.toString())); - cliOptions.add(CliOption.newBoolean(DISCRIMINATOR_FIELD_IGNORE, "Ignore discriminator field allOf, oneOf for Jackson serialization", discriminatorFieldIgnore)); + cliOptions.add(CliOption.newBoolean(DISABLE_DISCRIMINATOR_FIELD_IGNORE, "Ignore discriminator field allOf, oneOf for Jackson serialization", disableDiscriminatorFieldIgnore)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -428,7 +426,7 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, this::setGenerateConstructorWithAllArgs); convertPropertyToBooleanAndWriteBack(GENERATE_BUILDERS, this::setGenerateBuilders); - convertPropertyToBooleanAndWriteBack(DISCRIMINATOR_FIELD_IGNORE, this::setDiscriminatorFieldIgnore); + convertPropertyToBooleanAndWriteBack(DISABLE_DISCRIMINATOR_FIELD_IGNORE, this::setDisableDiscriminatorFieldIgnore); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); diff --git a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache index 002fea8b1ca4..a67c6e9aea27 100644 --- a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache @@ -1,11 +1,11 @@ {{#jackson}} -{{^discriminatorFieldIgnore}} +{{^disableDiscriminatorFieldIgnore}} @JsonIgnoreProperties( value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) -{{/discriminatorFieldIgnore}} +{{/disableDiscriminatorFieldIgnore}} @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) {{#discriminator.mappedModels}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java index 364e186cfc6d..9effcaf1cb74 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java @@ -46,7 +46,7 @@ import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; -import static org.openapitools.codegen.languages.AbstractJavaCodegen.DISCRIMINATOR_FIELD_IGNORE; +import static org.openapitools.codegen.languages.AbstractJavaCodegen.DISABLE_DISCRIMINATOR_FIELD_IGNORE; public class AbstractJavaCodegenTest { @@ -970,12 +970,12 @@ public void AnnotationsContainerTest() { } @Test - public void discriminatorFieldIgnoreFlagTest() { - codegen.additionalProperties().put(DISCRIMINATOR_FIELD_IGNORE, true); + public void disableDiscriminatorFieldIgnoreFlagTest() { + codegen.additionalProperties().put(DISABLE_DISCRIMINATOR_FIELD_IGNORE, true); codegen.preprocessOpenAPI(FLATTENED_SPEC.get("3_0/petstore")); - Assert.assertTrue((boolean) codegen.additionalProperties().get(DISCRIMINATOR_FIELD_IGNORE)); + Assert.assertTrue((boolean) codegen.additionalProperties().get(DISABLE_DISCRIMINATOR_FIELD_IGNORE)); } @Test 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 0b23cd7b0f0c..174a95e7627e 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 @@ -4066,17 +4066,17 @@ public void testOneOfInterfaceWithAnnotation() { } @Test - public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { + public void disableDiscriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, - Map.of(DISCRIMINATOR_FIELD_IGNORE, "true")); + Map.of(DISABLE_DISCRIMINATOR_FIELD_IGNORE, "true")); JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) .assertTypeAnnotations().doesNotContainWithName("JsonIgnoreProperties"); } @Test - public void discriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeAdded() { + public void disableDiscriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeAdded() { final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, - Map.of(DISCRIMINATOR_FIELD_IGNORE, "false")); + Map.of(DISABLE_DISCRIMINATOR_FIELD_IGNORE, "false")); JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) .assertTypeAnnotations().containsWithName("JsonIgnoreProperties"); } From 859d7e59913c0bfa6b066a0a39fb842bab0455a7 Mon Sep 17 00:00:00 2001 From: Daniel Nowosielecki Date: Wed, 10 Dec 2025 23:33:16 +0100 Subject: [PATCH 4/6] fix: remove newline --- .../src/main/resources/Java/typeInfoAnnotation.mustache | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache index a67c6e9aea27..a1c9eff3eb91 100644 --- a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache @@ -6,7 +6,6 @@ allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization ) {{/disableDiscriminatorFieldIgnore}} - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) {{#discriminator.mappedModels}} {{#-first}} From 87c701e3095bc2febd4e6952a17018713396182c Mon Sep 17 00:00:00 2001 From: Daniel Nowosielecki Date: Fri, 12 Dec 2025 14:11:08 +0100 Subject: [PATCH 5/6] fix: regenerate example models --- docs/generators/groovy.md | 3 +-- docs/generators/java-camel.md | 2 +- docs/generators/java-dubbo.md | 2 +- docs/generators/java-helidon-client.md | 2 +- docs/generators/java-helidon-server.md | 2 +- docs/generators/java-inflector.md | 2 +- docs/generators/java-micronaut-client.md | 2 +- docs/generators/java-micronaut-server.md | 2 +- docs/generators/java-microprofile.md | 2 +- docs/generators/java-msf4j.md | 2 +- docs/generators/java-pkmst.md | 2 +- docs/generators/java-play-framework.md | 2 +- docs/generators/java-undertow-server.md | 2 +- docs/generators/java-vertx-web.md | 2 +- docs/generators/java-vertx.md | 2 +- docs/generators/java-wiremock.md | 2 +- docs/generators/java.md | 2 +- docs/generators/jaxrs-cxf-cdi.md | 1 + docs/generators/jaxrs-cxf-client.md | 1 + docs/generators/jaxrs-cxf-extended.md | 1 + docs/generators/jaxrs-cxf.md | 1 + docs/generators/jaxrs-jersey.md | 1 + docs/generators/jaxrs-resteasy-eap.md | 1 + docs/generators/jaxrs-resteasy.md | 1 + docs/generators/jaxrs-spec.md | 1 + docs/generators/spring.md | 1 + .../codegen/languages/AbstractJavaCodegen.java | 8 ++++---- .../src/main/resources/Java/typeInfoAnnotation.mustache | 5 ++--- .../codegen/java/AbstractJavaCodegenTest.java | 8 ++++---- .../openapitools/codegen/java/JavaClientCodegenTest.java | 8 ++++---- .../main/java/org/openapitools/client/model/Animal.java | 1 + .../src/main/java/org/openapitools/client/model/Cat.java | 1 + .../org/openapitools/client/model/ChildWithNullable.java | 1 + .../src/main/java/org/openapitools/client/model/Dog.java | 1 + .../org/openapitools/client/model/ParentWithNullable.java | 1 + 35 files changed, 45 insertions(+), 33 deletions(-) diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 4c3951b997a5..a0b0d97ad509 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -69,8 +70,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| - ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index b51c1cb4a312..147d737d1db1 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -52,6 +52,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| @@ -116,7 +117,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useTags|use tags for creating interface and controller classnames| |false| |virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-dubbo.md b/docs/generators/java-dubbo.md index f4bf3fdadba7..25586148ba36 100644 --- a/docs/generators/java-dubbo.md +++ b/docs/generators/java-dubbo.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |dubboVersion|Dubbo version| |3.2.18| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| @@ -82,7 +83,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 261c45b629e6..590ca8626aa9 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -35,6 +35,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+)
|java8| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -68,7 +69,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index fb08abb6065c..6a9129d6d027 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+)
|java8| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -71,7 +72,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |x-helidon-groupBy|Selects how to group operations into APIs|
**tags**
Use the 'tags' settings on each operation
**first-path-segment**
Use the first segment of the path
|tags| |x-helidon-useOptional|Wrap optional parameters in an Optional (Helidon 4 and later)| |true| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index b62f77b35b48..40ee52ccb770 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -71,7 +72,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index 963e6a1214a1..ec0fb2e64c1d 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -48,6 +48,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -92,7 +93,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index 16cf16a74ae6..fbd33321d97a 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -43,6 +43,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -91,7 +92,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |visitable|Generate visitor for subtypes with a discriminator| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapInHttpResponse|Wrap the response in HttpResponse object| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 203016f8a240..d36bd38c3c4f 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
|source| |dynamicOperations|Generate operations dynamically at runtime from an OAS| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| @@ -109,7 +110,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index bd68b2dff859..6fca10e36fda 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -77,7 +78,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useTags|use tags for creating interface and controller classnames| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 13bcf1e96da9..1f4e25415800 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -40,6 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -78,7 +79,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |zipkinUri|Zipkin URI| |null| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 6ef4cff72fd0..8416eceebf64 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -81,7 +82,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useSwaggerUI|Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies| |true| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |wrapCalls|Add a wrapper to each controller function to handle things like metrics, response modification, etc..| |true| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 5af53c6aa537..a795309e4c5d 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -71,7 +72,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 6e2ae124829b..c5c313dd2098 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -71,7 +72,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index f39d31a1e4c0..3033b02ea265 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -74,7 +75,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index 324f9f6505ea..8631ce4771b7 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| @@ -71,7 +72,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java.md b/docs/generators/java.md index 2eeb07eeb472..c7806026d407 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
|source| |dynamicOperations|Generate operations dynamically at runtime from an OAS| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| @@ -109,7 +110,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| -|disableDiscriminatorFieldIgnore| whether to add jackson @JsonIgnoreProperties for discriminator in base class | |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 02f6b177827e..dcd00024c2c9 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index e735d8f0ef4b..d7883e0438d6 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -40,6 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**swagger1**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.
**swagger2**
Generate an OpenAPI 3 specification using Swagger-Core 2.x.
|swagger1| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index aeb82d2dce55..444d0957db5f 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**swagger1**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.
**swagger2**
Generate an OpenAPI 3 specification using Swagger-Core 2.x.
|swagger1| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index b9b120e2f8d9..ef16108eeb7c 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**swagger1**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.
**swagger2**
Generate an OpenAPI 3 specification using Swagger-Core 2.x.
|swagger1| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index a5d3e9a3c51a..429653d1a813 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 85a3ea082300..5e568820ea42 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index c03831051659..ad6c56a7ab83 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 03c2d043bf78..2829ca71081d 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 2af0fe826a3e..d99c172a0e63 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 13af9699a15e..7826efe7ff09 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -100,7 +100,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String JAVAX_PACKAGE = "javaxPackage"; public static final String USE_JAKARTA_EE = "useJakartaEe"; public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull"; - public static final String DISABLE_DISCRIMINATOR_FIELD_IGNORE = "disableDiscriminatorFieldIgnore"; + public static final String DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES = "disableDiscriminatorJsonIgnoreProperties"; public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign"; public static final String USE_ONE_OF_INTERFACES = "useOneOfInterfaces"; @@ -198,7 +198,7 @@ protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy, original} @Getter @Setter protected boolean generateBuilders; @Getter @Setter - protected boolean disableDiscriminatorFieldIgnore = false; + protected boolean disableDiscriminatorJsonIgnoreProperties = false; /** * useBeanValidation has been moved from child generators to AbstractJavaCodegen. * The reason is that getBeanValidation needs it @@ -346,7 +346,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null")); cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models").defaultValue(Boolean.FALSE.toString())); - cliOptions.add(CliOption.newBoolean(DISABLE_DISCRIMINATOR_FIELD_IGNORE, "Ignore discriminator field allOf, oneOf for Jackson serialization", disableDiscriminatorFieldIgnore)); + cliOptions.add(CliOption.newBoolean(DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES, "Ignore discriminator field type for Jackson serialization", disableDiscriminatorJsonIgnoreProperties)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -426,7 +426,7 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, this::setGenerateConstructorWithAllArgs); convertPropertyToBooleanAndWriteBack(GENERATE_BUILDERS, this::setGenerateBuilders); - convertPropertyToBooleanAndWriteBack(DISABLE_DISCRIMINATOR_FIELD_IGNORE, this::setDisableDiscriminatorFieldIgnore); + convertPropertyToBooleanAndWriteBack(DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES, this::setDisableDiscriminatorJsonIgnoreProperties); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); diff --git a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache index a1c9eff3eb91..13e0218e4aa4 100644 --- a/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/Java/typeInfoAnnotation.mustache @@ -1,11 +1,10 @@ {{#jackson}} -{{^disableDiscriminatorFieldIgnore}} +{{^disableDiscriminatorJsonIgnoreProperties}} @JsonIgnoreProperties( value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization -) -{{/disableDiscriminatorFieldIgnore}} +){{/disableDiscriminatorJsonIgnoreProperties}} @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) {{#discriminator.mappedModels}} {{#-first}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java index 9effcaf1cb74..0de76c2eed8a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java @@ -46,7 +46,7 @@ import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; -import static org.openapitools.codegen.languages.AbstractJavaCodegen.DISABLE_DISCRIMINATOR_FIELD_IGNORE; +import static org.openapitools.codegen.languages.AbstractJavaCodegen.DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES; public class AbstractJavaCodegenTest { @@ -970,12 +970,12 @@ public void AnnotationsContainerTest() { } @Test - public void disableDiscriminatorFieldIgnoreFlagTest() { - codegen.additionalProperties().put(DISABLE_DISCRIMINATOR_FIELD_IGNORE, true); + public void disableDiscriminatorJsonIgnorePropertiesFlagTest() { + codegen.additionalProperties().put(DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES, true); codegen.preprocessOpenAPI(FLATTENED_SPEC.get("3_0/petstore")); - Assert.assertTrue((boolean) codegen.additionalProperties().get(DISABLE_DISCRIMINATOR_FIELD_IGNORE)); + Assert.assertTrue((boolean) codegen.additionalProperties().get(DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES)); } @Test 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 174a95e7627e..773fd63dd448 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 @@ -4066,17 +4066,17 @@ public void testOneOfInterfaceWithAnnotation() { } @Test - public void disableDiscriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { + public void disableDiscriminatorJsonIgnorePropertiesIsTrueThenJsonIgnorePropertiesShouldBeNotAdded() { final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, - Map.of(DISABLE_DISCRIMINATOR_FIELD_IGNORE, "true")); + Map.of(DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES, "true")); JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) .assertTypeAnnotations().doesNotContainWithName("JsonIgnoreProperties"); } @Test - public void disableDiscriminatorFieldIgnoreIsTrueThenJsonIgnorePropertiesShouldBeAdded() { + public void disableDiscriminatorJsonIgnorePropertiesIsTrueThenJsonIgnorePropertiesShouldBeAdded() { final Map files = generateFromContract("src/test/resources/3_0/java/issue12777.yaml", RESTCLIENT, - Map.of(DISABLE_DISCRIMINATOR_FIELD_IGNORE, "false")); + Map.of(DISABLE_DISCRIMINATOR_JSON_IGNORE_PROPERTIES, "false")); JavaFileAssert.assertThat(files.get("BaseConfiguration.java")) .assertTypeAnnotations().containsWithName("JsonIgnoreProperties"); } diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java index 611fd81b89a2..2801e3fc7e39 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java @@ -39,6 +39,7 @@ value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization ) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java index 5ace0e368d56..e17677a2213d 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java @@ -39,6 +39,7 @@ value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization ) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) public class Cat extends Animal { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java index d35522d225eb..353d16ce1600 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java @@ -40,6 +40,7 @@ value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the type to be set during deserialization ) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) public class ChildWithNullable extends ParentWithNullable { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java index bd42e83f1dea..2085700a5baf 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java @@ -39,6 +39,7 @@ value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization ) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) public class Dog extends Animal { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 80e19bf69fec..93bda09cab5e 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -43,6 +43,7 @@ value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the type to be set during deserialization ) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), From 141311fc8f7ea1f36ad732903356e357ee321304 Mon Sep 17 00:00:00 2001 From: Daniel Nowosielecki Date: Fri, 12 Dec 2025 19:32:03 +0100 Subject: [PATCH 6/6] fix: regenerate --- docs/generators/groovy.md | 2 +- docs/generators/java-camel.md | 2 +- docs/generators/java-dubbo.md | 2 +- docs/generators/java-helidon-client.md | 2 +- docs/generators/java-helidon-server.md | 2 +- docs/generators/java-inflector.md | 2 +- docs/generators/java-micronaut-client.md | 2 +- docs/generators/java-micronaut-server.md | 2 +- docs/generators/java-microprofile.md | 2 +- docs/generators/java-msf4j.md | 2 +- docs/generators/java-pkmst.md | 2 +- docs/generators/java-play-framework.md | 2 +- docs/generators/java-undertow-server.md | 2 +- docs/generators/java-vertx-web.md | 2 +- docs/generators/java-vertx.md | 2 +- docs/generators/java-wiremock.md | 2 +- docs/generators/java.md | 2 +- docs/generators/jaxrs-cxf-cdi.md | 2 +- docs/generators/jaxrs-cxf-client.md | 2 +- docs/generators/jaxrs-cxf-extended.md | 2 +- docs/generators/jaxrs-cxf.md | 2 +- docs/generators/jaxrs-jersey.md | 2 +- docs/generators/jaxrs-resteasy-eap.md | 2 +- docs/generators/jaxrs-resteasy.md | 2 +- docs/generators/jaxrs-spec.md | 2 +- docs/generators/spring.md | 2 +- .../src/main/java/org/openapitools/client/model/Animal.java | 1 - .../src/main/java/org/openapitools/client/model/Cat.java | 1 - .../java/org/openapitools/client/model/ChildWithNullable.java | 1 - .../src/main/java/org/openapitools/client/model/Dog.java | 1 - .../java/org/openapitools/client/model/ParentWithNullable.java | 1 - 31 files changed, 26 insertions(+), 31 deletions(-) diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index a0b0d97ad509..07098bff33e1 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -34,10 +34,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index 147d737d1db1..1ad4a1fcd311 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -49,10 +49,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/java-dubbo.md b/docs/generators/java-dubbo.md index 25586148ba36..c4d25eab0357 100644 --- a/docs/generators/java-dubbo.md +++ b/docs/generators/java-dubbo.md @@ -38,10 +38,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |dubboVersion|Dubbo version| |3.2.18| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 590ca8626aa9..a14df9cf9af9 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -33,9 +33,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |configKey|Config key in @RegisterRestClient. Default to none.| |null| |containerDefaultToNull|Set containers (array, set, map) default to null| |false| |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+)
|java8| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index 6a9129d6d027..bb6968032c03 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -32,9 +32,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false| |containerDefaultToNull|Set containers (array, set, map) default to null| |false| |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+)
|java8| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 40ee52ccb770..67628887f973 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index ec0fb2e64c1d..e4fdad3d02c5 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -45,10 +45,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index fbd33321d97a..7191a7d93888 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -40,10 +40,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index d36bd38c3c4f..816568949837 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -41,10 +41,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
|source| |dynamicOperations|Generate operations dynamically at runtime from an OAS| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index 6fca10e36fda..15ef04839938 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 1f4e25415800..a1bbe25f8fc4 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -37,10 +37,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 8416eceebf64..c8f753257bc7 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -39,10 +39,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index a795309e4c5d..f9ef0f43f681 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index c5c313dd2098..d7ba4acf2d1d 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 3033b02ea265..f321cad67afb 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index 8631ce4771b7..6ece8ee33bef 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/java.md b/docs/generators/java.md index c7806026d407..d0e506e147c7 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -41,10 +41,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
|source| |dynamicOperations|Generate operations dynamically at runtime from an OAS| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index dcd00024c2c9..8c2dfa57f5ec 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index d7883e0438d6..4826e1fd1e72 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -37,10 +37,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**swagger1**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.
**swagger2**
Generate an OpenAPI 3 specification using Swagger-Core 2.x.
|swagger1| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 444d0957db5f..b075dd71f2a1 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -38,10 +38,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**swagger1**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.
**swagger2**
Generate an OpenAPI 3 specification using Swagger-Core 2.x.
|swagger1| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index ef16108eeb7c..f3d8f1025496 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -38,10 +38,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**swagger1**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.
**swagger2**
Generate an OpenAPI 3 specification using Swagger-Core 2.x.
|swagger1| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 429653d1a813..320597e3c2f2 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 5e568820ea42..92c9edd877ba 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index ad6c56a7ab83..c651b54a937a 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 2829ca71081d..3cd408b43e02 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -36,10 +36,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |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| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index d99c172a0e63..244aad5065cc 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -42,10 +42,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| -|discriminatorFieldIgnore|Ignore discriminator field allOf, oneOf for Jackson serialization| |false| |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java index 2801e3fc7e39..611fd81b89a2 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Animal.java @@ -39,7 +39,6 @@ value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization ) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java index e17677a2213d..5ace0e368d56 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Cat.java @@ -39,7 +39,6 @@ value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization ) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) public class Cat extends Animal { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java index 353d16ce1600..d35522d225eb 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ChildWithNullable.java @@ -40,7 +40,6 @@ value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the type to be set during deserialization ) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) public class ChildWithNullable extends ParentWithNullable { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java index 2085700a5baf..bd42e83f1dea 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/Dog.java @@ -39,7 +39,6 @@ value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization ) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) public class Dog extends Animal { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 93bda09cab5e..80e19bf69fec 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -43,7 +43,6 @@ value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the type to be set during deserialization ) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"),