diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 36dc7ffbd0b..e7493ca6d8b 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -61,6 +61,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index 9a6499fe85b..5438c703d5a 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -95,6 +95,16 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value +|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 68872647241..775a8d58abe 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -63,6 +63,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index e63a9c91ac9..6bf00520307 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -69,6 +69,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useBeanValidation|Use BeanValidation API annotations| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index 9f1cc7d305d..67d2870b8cb 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -71,6 +71,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useBeanValidation|Use BeanValidation API annotations| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index 99b40dd1fec..bae5eaf9253 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -69,6 +69,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 3696276e582..eb7454a2b24 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -70,6 +70,15 @@ 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| |zipkinUri|Zipkin URI| |null| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index a422fe17228..110f537d1df 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -73,6 +73,15 @@ 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| |wrapCalls|Add a wrapper to each controller function to handle things like metrics, response modification, etc..| |true| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index faed7e30e21..c20ab6b0802 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -63,6 +63,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 41353d46c66..f8e1e6f775a 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -63,6 +63,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 095100d66ea..27a7ee0a002 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -66,6 +66,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/java.md b/docs/generators/java.md index 69403810d01..44c8c3cb585 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -84,6 +84,16 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value +|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono/Flux` or `return T/List/Set` & execute `.block()` inside generated method)|OPERATION|false + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 7f3d9c0b363..85c3caa929e 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -76,6 +76,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index 287517ca3e4..e1f375f0c96 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -67,6 +67,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useLoggingFeatureForTests|Use Logging Feature for tests| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 021ae03417d..1d1cd197970 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -90,6 +90,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useWadlFeature|Use WADL Feature| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index 31a69554770..cc17d44b9d4 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -85,6 +85,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useWadlFeature|Use WADL Feature| |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 31d340f076c..781d27b728a 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -70,6 +70,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 698ffd9b409..741458572ed 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -70,6 +70,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 13852ca4caf..f84b4ee62c4 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -69,6 +69,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index f89dfc45c8c..bb915c9ed65 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -76,6 +76,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/docs/generators/spring.md b/docs/generators/spring.md index f63fea0e35c..b820f6c1852 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -88,6 +88,16 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| +|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array +|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value +|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false + + ## IMPORT MAPPING | Type/Alias | Imports | diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java index 3bfd97c90a4..c1e4d2dd495 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java @@ -24,6 +24,7 @@ import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConfigLoader; import org.openapitools.codegen.GeneratorNotFoundException; +import org.openapitools.codegen.VendorExtension; import org.openapitools.codegen.meta.FeatureSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -89,6 +90,10 @@ public class ConfigHelp extends OpenApiGeneratorCommand { "--markdown-header"}, title = "markdown header", description = "When format=markdown, include this option to write out markdown headers (e.g. for docusaurus).") private Boolean markdownHeader; + @Option(name = { + "--supported-vendor-extensions"}, title = "supported vendor extensions", description = "List supported vendor extensions") + private Boolean supportedVendorExtensions; + @Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --feature-set)") private Boolean fullDetails; @@ -108,6 +113,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand { importMappings = Boolean.TRUE; featureSets = Boolean.TRUE; metadata = Boolean.TRUE; + supportedVendorExtensions = Boolean.TRUE; } try { @@ -198,6 +204,27 @@ public class ConfigHelp extends OpenApiGeneratorCommand { }); } + private void generateMdSupportedVendorExtensions(StringBuilder sb, CodegenConfig config) { + List supportedVendorExtensions = config.getSupportedVendorExtensions(); + if (supportedVendorExtensions.isEmpty()) { + return; + } + + sb + .append(newline).append("## SUPPORTED VENDOR EXTENSIONS").append(newline).append(newline) + .append("| Extension name | Description | Applicable for | Default value |").append(newline) + .append("| -------------- | ----------- | -------------- | ------------- |").append(newline); + + supportedVendorExtensions.forEach( + extension -> sb.append("|").append(extension.getName()) + .append("|").append(extension.getDescription()) + .append("|").append(extension.getLevels().stream().map(Objects::toString).collect(Collectors.joining(", "))) + .append("|").append(extension.getDefaultValue()) + .append(newline) + ); + sb.append(newline); + } + private void generateMdImportMappings(StringBuilder sb, CodegenConfig config) { sb.append(newline).append("## IMPORT MAPPING").append(newline).append(newline); @@ -332,6 +359,10 @@ public class ConfigHelp extends OpenApiGeneratorCommand { generateMdConfigOptionsHeader(sb, config); generateMdConfigOptions(sb, config); + if (Boolean.TRUE.equals(supportedVendorExtensions)) { + generateMdSupportedVendorExtensions(sb, config); + } + if (Boolean.TRUE.equals(importMappings)) { generateMdImportMappings(sb, config); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java index 952d3a841f2..995ceb09675 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java @@ -305,13 +305,15 @@ public interface CodegenConfig { Schema unaliasSchema(Schema schema, Map usedImportMappings); - public String defaultTemplatingEngine(); + String defaultTemplatingEngine(); - public GeneratorLanguage generatorLanguage(); + GeneratorLanguage generatorLanguage(); /* the version of the language that the generator implements For python 3.9.0, generatorLanguageVersion would be "3.9.0" */ - public String generatorLanguageVersion(); + String generatorLanguageVersion(); + + List getSupportedVendorExtensions(); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index efe4efdff1b..db0f18682bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -7407,5 +7407,8 @@ public class DefaultCodegen implements CodegenConfig { return null; } - ; + @Override + public List getSupportedVendorExtensions() { + return new ArrayList<>(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java new file mode 100644 index 00000000000..77fe6099da0 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java @@ -0,0 +1,53 @@ +package org.openapitools.codegen; + +import java.util.Collections; +import java.util.List; + +public enum VendorExtension { + + X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"), + X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters", "false"), + X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""), + X_SETTER_EXTRA_ANNOTATION("x-setter-extra-annotation", ExtensionLevel.FIELD, "Custom annotation that can be specified over java setter for specific field", "When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value"), + X_WEBCLIENT_BLOCKING("x-webclient-blocking", ExtensionLevel.OPERATION, "Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono/Flux` or `return T/List/Set` & execute `.block()` inside generated method)", "false") + ; + + private final String name; + private final List levels; + private final String description; + private final String defaultValue; + + VendorExtension(final String name, final List levels, final String description, final String defaultValue) { + this.name = name; + this.levels = levels; + this.description = description; + this.defaultValue = defaultValue; + } + + VendorExtension(final String name, final ExtensionLevel level, final String description, final String defaultValue) { + this(name, Collections.singletonList(level), description, defaultValue); + } + + public String getName() { + return name; + } + + public List getLevels() { + return levels; + } + + public String getDescription() { + return description; + } + + public String getDefaultValue() { + return defaultValue; + } + + public enum ExtensionLevel { + FIELD, + MODEL, + OPERATION + } + +} 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 aaf5489eb6d..59c4990990b 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 @@ -2002,4 +2002,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code } } + @Override + public List getSupportedVendorExtensions() { + List extensions = super.getSupportedVendorExtensions(); + extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE); + extensions.add(VendorExtension.X_IMPLEMENTS); + extensions.add(VendorExtension.X_SETTER_EXTRA_ANNOTATION); + return extensions; + } } 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 330744bca40..5571db7ffcf 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 @@ -1059,4 +1059,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen } } } + + @Override + public List getSupportedVendorExtensions() { + List extensions = super.getSupportedVendorExtensions(); + extensions.add(VendorExtension.X_WEBCLIENT_BLOCKING); + return extensions; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 3230786bca8..10b2748b201 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -48,6 +48,7 @@ import org.openapitools.codegen.CodegenResponse; import org.openapitools.codegen.CodegenSecurity; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.VendorExtension; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.DocumentationProviderFeatures; import org.openapitools.codegen.languages.features.OptionalFeatures; @@ -983,4 +984,11 @@ public class SpringCodegen extends AbstractJavaCodegen public void setUseSwaggerUI(boolean useSwaggerUI) { this.useSwaggerUI = useSwaggerUI; } + + @Override + public List getSupportedVendorExtensions() { + List extensions = super.getSupportedVendorExtensions(); + extensions.add(VendorExtension.X_SPRING_PAGINATED); + return extensions; + } }