forked from loafle/openapi-generator-original
[JAVA] Handle camlCase with $ as first char (#13292)
* Lowercase first char and not first letter for variable names * Samples * Limit caml case fix impact with cli a property
This commit is contained in:
parent
8eb3064b2e
commit
574a70c315
@ -7,3 +7,4 @@ additionalProperties:
|
|||||||
artifactId: springboot
|
artifactId: springboot
|
||||||
snapshotVersion: "true"
|
snapshotVersion: "true"
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
camelCaseDollarSign: "true"
|
||||||
|
@ -26,6 +26,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|camelDataformatProperties|list of dataformat properties separated by comma (propertyName1=propertyValue2,...| ||
|
|camelDataformatProperties|list of dataformat properties separated by comma (propertyName1=propertyValue2,...| ||
|
||||||
|camelRestBindingMode|binding mode to be used by the REST consumer| |auto|
|
|camelRestBindingMode|binding mode to be used by the REST consumer| |auto|
|
||||||
|camelRestClientRequestValidation|enable validation of the client request to check whether the Content-Type and Accept headers from the client is supported by the Rest-DSL configuration| |false|
|
|camelRestClientRequestValidation|enable validation of the client request to check whether the Content-Type and Accept headers from the client is supported by the Rest-DSL configuration| |false|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|configureAuth|Configure all the authorization methods as specified in the file| |false|
|
|configureAuth|Configure all the authorization methods as specified in the file| |false|
|
||||||
|dateFormat|Specify the format pattern of date as a string| |null|
|
|dateFormat|Specify the format pattern of date as a string| |null|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|
@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|controllerPackage|The package in which controllers will be generated| |org.openapitools.api|
|
|controllerPackage|The package in which controllers will be generated| |org.openapitools.api|
|
||||||
|dateFormat|Specify the format pattern of date as a string| |null|
|
|dateFormat|Specify the format pattern of date as a string| |null|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|basePackage|base package for java source code| |null|
|
|basePackage|base package for java source code| |null|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|basePackage|base package for generated code| |org.openapitools|
|
|basePackage|base package for generated code| |org.openapitools|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||||
|controllerOnly|Whether to generate only API interface stubs without the server files.| |false|
|
|controllerOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|asyncNative|If true, async handlers will be used, instead of the sync version| |false|
|
|asyncNative|If true, async handlers will be used, instead of the sync version| |false|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
||||||
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||||
|
@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||||
|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||||
|
@ -3715,7 +3715,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
} else {
|
} else {
|
||||||
property.openApiType = p.getType();
|
property.openApiType = p.getType();
|
||||||
}
|
}
|
||||||
property.nameInCamelCase = camelize(property.name, false);
|
property.nameInCamelCase = camelize(property.name);
|
||||||
property.nameInSnakeCase = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, property.nameInCamelCase);
|
property.nameInSnakeCase = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, property.nameInCamelCase);
|
||||||
property.description = escapeText(p.getDescription());
|
property.description = escapeText(p.getDescription());
|
||||||
property.unescapedDescription = p.getDescription();
|
property.unescapedDescription = p.getDescription();
|
||||||
|
@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
abstract public class AbstractAdaCodegen extends DefaultCodegen implements CodegenConfig {
|
abstract public class AbstractAdaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -826,7 +827,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
|||||||
// method with only the scope that it requires. We have to create a new auth method
|
// method with only the scope that it requires. We have to create a new auth method
|
||||||
// instance because the original object must not be modified.
|
// instance because the original object must not be modified.
|
||||||
List<String> opScopes = (scopes == null) ? null : scopes.get(authMethod.name);
|
List<String> opScopes = (scopes == null) ? null : scopes.get(authMethod.name);
|
||||||
authMethod.name = camelize(sanitizeName(authMethod.name), true);
|
authMethod.name = camelize(sanitizeName(authMethod.name), LOWERCASE_FIRST_LETTER);
|
||||||
if (opScopes != null) {
|
if (opScopes != null) {
|
||||||
CodegenSecurity opSecurity = new CodegenSecurity();
|
CodegenSecurity opSecurity = new CodegenSecurity();
|
||||||
opSecurity.name = authMethod.name;
|
opSecurity.name = authMethod.name;
|
||||||
|
@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -111,7 +112,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
@ -422,11 +423,11 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import java.io.IOException;
|
|||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
|
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -974,7 +975,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
|
|
||||||
// camelize(lower) the variable name
|
// camelize(lower) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
|
@ -28,6 +28,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public abstract class AbstractDartCodegen extends DefaultCodegen {
|
public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||||
@ -373,7 +374,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
if (name.matches("^\\d.*")) {
|
if (name.matches("^\\d.*")) {
|
||||||
name = "n" + name;
|
name = "n" + name;
|
||||||
@ -721,18 +722,18 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
public String toOperationId(String operationId) {
|
public String toOperationId(String operationId) {
|
||||||
operationId = super.toOperationId(operationId);
|
operationId = super.toOperationId(operationId);
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
operationId = newOperationId;
|
operationId = newOperationId;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -343,7 +344,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
String sanitizedOperationId = camelize(sanitizeName(operationId), true);
|
String sanitizedOperationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(sanitizedOperationId)) {
|
if (isReservedWord(sanitizedOperationId)) {
|
||||||
@ -354,7 +355,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
|||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
||||||
sanitizedOperationId = camelize("call_" + sanitizedOperationId, true);
|
sanitizedOperationId = camelize("call_" + sanitizedOperationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// method name from updateSomething to update_Something.
|
// method name from updateSomething to update_Something.
|
||||||
|
@ -38,6 +38,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -661,7 +662,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -707,7 +708,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
|||||||
|
|
||||||
// camelize(lower) the variable name
|
// camelize(lower) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
|
@ -34,6 +34,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -232,7 +233,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
|||||||
// params should be lowerCamelCase. E.g. "person Person", instead of
|
// params should be lowerCamelCase. E.g. "person Person", instead of
|
||||||
// "Person Person".
|
// "Person Person".
|
||||||
//
|
//
|
||||||
name = camelize(toVarName(name), true);
|
name = camelize(toVarName(name), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// REVISIT: Actually, for idiomatic go, the param name should
|
// REVISIT: Actually, for idiomatic go, the param name should
|
||||||
// really should just be a letter, e.g. "p Person"), but we'll get
|
// really should just be a letter, e.g. "p Person"), but we'll get
|
||||||
|
@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -160,7 +161,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
|||||||
if (name.matches("^[A-Z_]*$"))
|
if (name.matches("^[A-Z_]*$"))
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name))
|
if (isReservedWord(name))
|
||||||
@ -326,7 +327,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
|||||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(sanitizedOperationId, false);
|
return camelize(sanitizedOperationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,6 +40,7 @@ import org.openapitools.codegen.model.ModelMap;
|
|||||||
import org.openapitools.codegen.model.ModelsMap;
|
import org.openapitools.codegen.model.ModelsMap;
|
||||||
import org.openapitools.codegen.model.OperationMap;
|
import org.openapitools.codegen.model.OperationMap;
|
||||||
import org.openapitools.codegen.model.OperationsMap;
|
import org.openapitools.codegen.model.OperationsMap;
|
||||||
|
import org.openapitools.codegen.utils.CamelizeOption;
|
||||||
import org.openapitools.codegen.utils.ModelUtils;
|
import org.openapitools.codegen.utils.ModelUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -55,6 +56,7 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.*;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig,
|
public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig,
|
||||||
@ -81,6 +83,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
public static final String IMPLICIT_HEADERS = "implicitHeaders";
|
public static final String IMPLICIT_HEADERS = "implicitHeaders";
|
||||||
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
|
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
|
||||||
|
|
||||||
|
public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign";
|
||||||
|
|
||||||
public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi";
|
public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi";
|
||||||
|
|
||||||
protected String dateLibrary = "java8";
|
protected String dateLibrary = "java8";
|
||||||
@ -130,6 +134,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
protected boolean implicitHeaders = false;
|
protected boolean implicitHeaders = false;
|
||||||
protected String implicitHeadersRegex = null;
|
protected String implicitHeadersRegex = null;
|
||||||
|
|
||||||
|
protected boolean camelCaseDollarSign = false;
|
||||||
|
|
||||||
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||||
|
|
||||||
public AbstractJavaCodegen() {
|
public AbstractJavaCodegen() {
|
||||||
@ -262,6 +268,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable));
|
cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable));
|
||||||
cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", implicitHeaders));
|
cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", implicitHeaders));
|
||||||
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
|
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
|
||||||
|
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
|
||||||
|
|
||||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
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));
|
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
|
||||||
@ -549,6 +556,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
this.setImplicitHeadersRegex(additionalProperties.get(IMPLICIT_HEADERS_REGEX).toString());
|
this.setImplicitHeadersRegex(additionalProperties.get(IMPLICIT_HEADERS_REGEX).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey(CAMEL_CASE_DOLLAR_SIGN)) {
|
||||||
|
this.setCamelCaseDollarSign(Boolean.parseBoolean(additionalProperties.get(CAMEL_CASE_DOLLAR_SIGN).toString()));
|
||||||
|
}
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) {
|
if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) {
|
||||||
additionalProperties.put("parentOverridden", true);
|
additionalProperties.put("parentOverridden", true);
|
||||||
}
|
}
|
||||||
@ -795,7 +806,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
if (camelCaseDollarSign) {
|
||||||
|
name = camelize(name, LOWERCASE_FIRST_CHAR);
|
||||||
|
} else {
|
||||||
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
}
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
@ -1261,11 +1276,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
@ -1273,7 +1288,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true);
|
||||||
operationId = camelize("call_" + operationId, true);
|
operationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return operationId;
|
return operationId;
|
||||||
@ -1902,6 +1917,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
this.implicitHeadersRegex = implicitHeadersRegex;
|
this.implicitHeadersRegex = implicitHeadersRegex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCamelCaseDollarSign(boolean camelCaseDollarSign) {
|
||||||
|
this.camelCaseDollarSign = camelCaseDollarSign;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String escapeQuotationMark(String input) {
|
public String escapeQuotationMark(String input) {
|
||||||
// remove " to avoid code injection
|
// remove " to avoid code injection
|
||||||
@ -1984,7 +2003,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getterAndSetterCapitalize(String name) {
|
public String getterAndSetterCapitalize(String name) {
|
||||||
boolean lowercaseFirstLetter = false;
|
CamelizeOption camelizeOption = UPPERCASE_FIRST_CHAR;
|
||||||
if (name == null || name.length() == 0) {
|
if (name == null || name.length() == 0) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -1996,9 +2015,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
// http://download.oracle.com/otn-pub/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/beans.101.pdf)
|
// http://download.oracle.com/otn-pub/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/beans.101.pdf)
|
||||||
//
|
//
|
||||||
if (name.length() > 1 && Character.isLowerCase(name.charAt(0)) && Character.isUpperCase(name.charAt(1))) {
|
if (name.length() > 1 && Character.isLowerCase(name.charAt(0)) && Character.isUpperCase(name.charAt(1))) {
|
||||||
lowercaseFirstLetter = true;
|
camelizeOption = LOWERCASE_FIRST_LETTER;
|
||||||
}
|
}
|
||||||
return camelize(name, lowercaseFirstLetter);
|
return camelize(name, camelizeOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,6 +39,7 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
|
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -625,7 +626,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
break;
|
break;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
// NOTE: Removes hyphens and underscores
|
// NOTE: Removes hyphens and underscores
|
||||||
modified = camelize(modified, true);
|
modified = camelize(modified, LOWERCASE_FIRST_LETTER);
|
||||||
break;
|
break;
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
// NOTE: Removes hyphens and underscores
|
// NOTE: Removes hyphens and underscores
|
||||||
@ -755,19 +756,19 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
if (StringUtils.isEmpty(operationId))
|
if (StringUtils.isEmpty(operationId))
|
||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), LOWERCASE_FIRST_LETTER);
|
||||||
operationId = camelize("call_" + operationId, true);
|
operationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return operationId;
|
return operationId;
|
||||||
@ -921,7 +922,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
public String toVarName(String name) {
|
public String toVarName(String name) {
|
||||||
name = toVariableName(name);
|
name = toVariableName(name);
|
||||||
if (propertyAdditionalKeywords.contains(name)) {
|
if (propertyAdditionalKeywords.contains(name)) {
|
||||||
return camelize("property_" + name, true);
|
return camelize("property_" + name, LOWERCASE_FIRST_LETTER);
|
||||||
} else {
|
} else {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -959,7 +960,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number or containing dollar symbol, escape it
|
// for reserved word or word starting with number or containing dollar symbol, escape it
|
||||||
if (isReservedWord(name) || name.matches("(^\\d.*)|(.*[$].*)")) {
|
if (isReservedWord(name) || name.matches("(^\\d.*)|(.*[$].*)")) {
|
||||||
|
@ -35,6 +35,9 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -413,9 +416,9 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
|||||||
if ("camelCase".equals(variableNamingConvention)) {
|
if ("camelCase".equals(variableNamingConvention)) {
|
||||||
// return the name in camelCase style
|
// return the name in camelCase style
|
||||||
// phone_number => phoneNumber
|
// phone_number => phoneNumber
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
} else if ("PascalCase".equals(variableNamingConvention)) {
|
} else if ("PascalCase".equals(variableNamingConvention)) {
|
||||||
name = camelize(name, false);
|
name = camelize(name, UPPERCASE_FIRST_CHAR);
|
||||||
} else { // default to snake case
|
} else { // default to snake case
|
||||||
// return the name in underscore style
|
// return the name in underscore style
|
||||||
// PhoneNumber => phone_number
|
// PhoneNumber => phone_number
|
||||||
@ -542,17 +545,17 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
|||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER));
|
||||||
operationId = "call_" + operationId;
|
operationId = "call_" + operationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER));
|
||||||
operationId = "call_" + operationId;
|
operationId = "call_" + operationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(sanitizeName(operationId), true);
|
return camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,7 +313,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
|||||||
if (name == null || name.length() == 0) {
|
if (name == null || name.length() == 0) {
|
||||||
return "DefaultController";
|
return "DefaultController";
|
||||||
}
|
}
|
||||||
return camelize(name, false) + "Controller";
|
return camelize(name) + "Controller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ package org.openapitools.codegen.languages;
|
|||||||
|
|
||||||
import com.samskivert.mustache.Escapers;
|
import com.samskivert.mustache.Escapers;
|
||||||
import com.samskivert.mustache.Mustache;
|
import com.samskivert.mustache.Mustache;
|
||||||
|
import com.samskivert.mustache.Template;
|
||||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||||
import io.swagger.v3.oas.models.media.Schema;
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
import io.swagger.v3.oas.models.media.StringSchema;
|
import io.swagger.v3.oas.models.media.StringSchema;
|
||||||
@ -27,15 +28,20 @@ import org.apache.commons.io.FilenameUtils;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
import org.openapitools.codegen.model.ModelsMap;
|
import org.openapitools.codegen.model.ModelsMap;
|
||||||
|
import org.openapitools.codegen.utils.CamelizeOption;
|
||||||
import org.openapitools.codegen.utils.ModelUtils;
|
import org.openapitools.codegen.utils.ModelUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.Writer;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
|
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -293,7 +299,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -527,7 +533,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
|||||||
if (specialCharReplacements.containsKey(name)) {
|
if (specialCharReplacements.containsKey(name)) {
|
||||||
name = specialCharReplacements.get(name);
|
name = specialCharReplacements.get(name);
|
||||||
}
|
}
|
||||||
String identifier = camelize(sanitizeName(name), true);
|
String identifier = camelize(sanitizeName(name), LOWERCASE_FIRST_LETTER);
|
||||||
if (capitalized) {
|
if (capitalized) {
|
||||||
identifier = StringUtils.capitalize(identifier);
|
identifier = StringUtils.capitalize(identifier);
|
||||||
}
|
}
|
||||||
@ -588,11 +594,11 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
@ -600,7 +606,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
|||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
||||||
operationId = camelize("call_" + operationId, true);
|
operationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return operationId;
|
return operationId;
|
||||||
@ -614,4 +620,32 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
|||||||
public GeneratorLanguage generatorLanguage() {
|
public GeneratorLanguage generatorLanguage() {
|
||||||
return GeneratorLanguage.SCALA;
|
return GeneratorLanguage.SCALA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static abstract class CustomLambda implements Mustache.Lambda {
|
||||||
|
@Override
|
||||||
|
public void execute(Template.Fragment frag, Writer out) throws IOException {
|
||||||
|
final StringWriter tempWriter = new StringWriter();
|
||||||
|
frag.execute(tempWriter);
|
||||||
|
out.write(formatFragment(tempWriter.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String formatFragment(String fragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class CamelizeLambda extends CustomLambda {
|
||||||
|
private final CamelizeOption option;
|
||||||
|
|
||||||
|
public CamelizeLambda(boolean capitalizeFirst) {
|
||||||
|
if (capitalizeFirst) {
|
||||||
|
option = UPPERCASE_FIRST_CHAR;
|
||||||
|
} else {
|
||||||
|
option = LOWERCASE_FIRST_LETTER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatFragment(String fragment) {
|
||||||
|
return camelize(fragment, option);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.*;
|
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.*;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -757,7 +758,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
throw new RuntimeException("Empty method name (operationId) not allowed");
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
operationId = toSafeIdentifier(operationId);
|
operationId = toSafeIdentifier(operationId);
|
||||||
|
|
||||||
return operationId;
|
return operationId;
|
||||||
@ -802,7 +803,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -820,7 +821,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -911,7 +912,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(underscore(name), true);
|
return camelize(underscore(name), LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(underscore(name));
|
return camelize(underscore(name));
|
||||||
case snake_case:
|
case snake_case:
|
||||||
|
@ -30,6 +30,7 @@ import java.io.File;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -267,7 +268,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
@ -394,11 +395,11 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
throw new RuntimeException("Empty method name (operationId) not allowed");
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -807,7 +808,7 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public String toOperationId(String operationId) {
|
public String toOperationId(String operationId) {
|
||||||
// rename to empty_method_name_1 (e.g.) if method name is empty
|
// rename to empty_method_name_1 (e.g.) if method name is empty
|
||||||
if (StringUtils.isEmpty(operationId)) {
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
operationId = camelize("empty_method_name_" + emptyMethodNameCounter++, true);
|
operationId = camelize("empty_method_name_" + emptyMethodNameCounter++, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("Empty method name (operationId) found. Renamed to {}", operationId);
|
LOGGER.warn("Empty method name (operationId) found. Renamed to {}", operationId);
|
||||||
return operationId;
|
return operationId;
|
||||||
}
|
}
|
||||||
@ -825,7 +826,7 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
operationId = "call_" + operationId;
|
operationId = "call_" + operationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(sanitizeName(operationId), true);
|
return camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,6 +32,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -733,19 +734,19 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize(sanitizeName("call_" + operationId), true);
|
String newOperationId = camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
String newOperationId = camelize(sanitizeName("call_" + operationId), true);
|
String newOperationId = camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(sanitizeName(operationId), true);
|
return camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,6 +31,7 @@ import java.io.File;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -835,7 +836,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
|
@ -42,6 +42,7 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -490,7 +491,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
|
@ -37,6 +37,7 @@ import java.util.function.Consumer;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -415,7 +416,7 @@ public class CSharpNetCoreReducedClientCodegen extends AbstractCSharpCodegen {
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
|
@ -32,6 +32,7 @@ import java.util.EnumSet;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class CppTizenClientCodegen extends AbstractCppCodegen implements CodegenConfig {
|
public class CppTizenClientCodegen extends AbstractCppCodegen implements CodegenConfig {
|
||||||
@ -311,7 +312,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add_pet_by_id => addPetById
|
// add_pet_by_id => addPetById
|
||||||
return camelize(operationId, true);
|
return camelize(operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Output the Getter name for boolean property, e.g. getActive
|
* Output the Getter name for boolean property, e.g. getActive
|
||||||
|
@ -485,7 +485,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
|||||||
languageSpecificPrimitives.contains(type)) {
|
languageSpecificPrimitives.contains(type)) {
|
||||||
return type;
|
return type;
|
||||||
} else {
|
} else {
|
||||||
return modelNamePrefix + camelize(sanitizeName(type), false);
|
return modelNamePrefix + camelize(sanitizeName(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Unreal variable names are CamelCase
|
//Unreal variable names are CamelCase
|
||||||
String camelCaseName = camelize(name, false);
|
String camelCaseName = camelize(name);
|
||||||
|
|
||||||
//Avoid empty variable name at all costs
|
//Avoid empty variable name at all costs
|
||||||
if(!camelCaseName.isEmpty()) {
|
if(!camelCaseName.isEmpty()) {
|
||||||
@ -527,7 +527,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toApiName(String type) {
|
public String toApiName(String type) {
|
||||||
return modelNamePrefix + camelize(type, false) + "Api";
|
return modelNamePrefix + camelize(type) + "Api";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,6 +43,7 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -187,11 +188,11 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
@ -199,7 +200,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
||||||
operationId = camelize("call_" + operationId, true);
|
operationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return operationId;
|
return operationId;
|
||||||
@ -226,7 +227,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVarName(String name) {
|
public String toVarName(String name) {
|
||||||
final String varName = camelize(name.replaceAll("[^a-zA-Z0-9_]", ""), true);
|
final String varName = camelize(name.replaceAll("[^a-zA-Z0-9_]", ""), LOWERCASE_FIRST_LETTER);
|
||||||
return isReservedWord(varName) ? escapeReservedWord(name) : varName;
|
return isReservedWord(varName) ? escapeReservedWord(name) : varName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import java.util.EnumSet;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -297,7 +298,7 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
// underscore the variable name
|
// underscore the variable name
|
||||||
// petId => pet_id
|
// petId => pet_id
|
||||||
name = camelize(dropDots(name), true);
|
name = camelize(dropDots(name), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
|
@ -41,6 +41,7 @@ import java.io.IOException;
|
|||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class GoClientCodegen extends AbstractGoCodegen {
|
public class GoClientCodegen extends AbstractGoCodegen {
|
||||||
@ -392,7 +393,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
|||||||
@Override
|
@Override
|
||||||
public CodegenProperty fromProperty(String name, Schema p, boolean required) {
|
public CodegenProperty fromProperty(String name, Schema p, boolean required) {
|
||||||
CodegenProperty prop = super.fromProperty(name, p, required);
|
CodegenProperty prop = super.fromProperty(name, p, required);
|
||||||
String cc = camelize(prop.name, true);
|
String cc = camelize(prop.name, LOWERCASE_FIRST_LETTER);
|
||||||
if (isReservedWord(cc)) {
|
if (isReservedWord(cc)) {
|
||||||
cc = escapeReservedWord(cc);
|
cc = escapeReservedWord(cc);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -1171,9 +1173,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toVarName(String prefix, String name) {
|
public String toVarName(String prefix, String name) {
|
||||||
Boolean hasPrefix = !StringUtils.isBlank(prefix);
|
boolean hasPrefix = !StringUtils.isBlank(prefix);
|
||||||
name = underscore(sanitizeName(name.replaceAll("-", "_")));
|
name = underscore(sanitizeName(name.replaceAll("-", "_")));
|
||||||
name = camelize(name, !hasPrefix);
|
name = camelize(name, hasPrefix ? UPPERCASE_FIRST_CHAR : LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
if (hasPrefix) {
|
if (hasPrefix) {
|
||||||
return prefix + name;
|
return prefix + name;
|
||||||
} else {
|
} else {
|
||||||
@ -1227,7 +1230,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
|||||||
if (StringUtils.isEmpty(operationId)) {
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
operationId = escapeIdentifier("op", camelize(sanitizeName(operationId), true));
|
operationId = escapeIdentifier("op", camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER));
|
||||||
return operationId;
|
return operationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class HaskellServantCodegen extends DefaultCodegen implements CodegenConfig {
|
public class HaskellServantCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -592,7 +593,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
op.vendorExtensions.put("x-client-type", joinStrings(" -> ", type));
|
op.vendorExtensions.put("x-client-type", joinStrings(" -> ", type));
|
||||||
op.vendorExtensions.put("x-form-name", "Form" + camelize(op.operationId));
|
op.vendorExtensions.put("x-form-name", "Form" + camelize(op.operationId));
|
||||||
for (CodegenParameter param : op.formParams) {
|
for (CodegenParameter param : op.formParams) {
|
||||||
param.vendorExtensions.put("x-form-prefix", camelize(op.operationId, true));
|
param.vendorExtensions.put("x-form-prefix", camelize(op.operationId, LOWERCASE_FIRST_LETTER));
|
||||||
}
|
}
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
@ -658,7 +659,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From the model name, compute the prefix for the fields.
|
// From the model name, compute the prefix for the fields.
|
||||||
String prefix = camelize(model.classname, true);
|
String prefix = camelize(model.classname, LOWERCASE_FIRST_LETTER);
|
||||||
for (CodegenProperty prop : model.vars) {
|
for (CodegenProperty prop : model.vars) {
|
||||||
prop.name = toVarName(prefix + camelize(fixOperatorChars(prop.name)));
|
prop.name = toVarName(prefix + camelize(fixOperatorChars(prop.name)));
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
||||||
|
|
||||||
@ -571,7 +572,7 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From the model name, compute the prefix for the fields.
|
// From the model name, compute the prefix for the fields.
|
||||||
String prefix = camelize(model.classname, true);
|
String prefix = camelize(model.classname, LOWERCASE_FIRST_LETTER);
|
||||||
for (CodegenProperty prop : model.vars) {
|
for (CodegenProperty prop : model.vars) {
|
||||||
prop.name = toVarName(prefix + camelize(fixOperatorChars(prop.name)));
|
prop.name = toVarName(prefix + camelize(fixOperatorChars(prop.name)));
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ import java.util.regex.Pattern;
|
|||||||
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
|
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
|
||||||
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
||||||
import static java.util.Collections.sort;
|
import static java.util.Collections.sort;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class JavaClientCodegen extends AbstractJavaCodegen
|
public class JavaClientCodegen extends AbstractJavaCodegen
|
||||||
@ -762,7 +763,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
for (int i = 0; i < items.length; ++i) {
|
for (int i = 0; i < items.length; ++i) {
|
||||||
if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {}
|
if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {}
|
||||||
// camelize path variable
|
// camelize path variable
|
||||||
items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), true) + "}";
|
items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), LOWERCASE_FIRST_LETTER) + "}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
op.path = StringUtils.join(items, "/");
|
op.path = StringUtils.join(items, "/");
|
||||||
|
@ -33,6 +33,7 @@ import java.io.File;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -512,7 +513,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen {
|
|||||||
title = title.substring(0, title.length() - 3);
|
title = title.substring(0, title.length() - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.title = camelize(sanitizeName(title), true);
|
this.title = camelize(sanitizeName(title), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
additionalProperties.put(TITLE, this.title);
|
additionalProperties.put(TITLE, this.title);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
|
public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
|
||||||
@ -330,7 +331,7 @@ public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements Bea
|
|||||||
Matcher match = pathVariableMatcher.matcher(operation.path);
|
Matcher match = pathVariableMatcher.matcher(operation.path);
|
||||||
while (match.find()) {
|
while (match.find()) {
|
||||||
String completeMatch = match.group();
|
String completeMatch = match.group();
|
||||||
String replacement = ":" + camelize(match.group(1), true);
|
String replacement = ":" + camelize(match.group(1), LOWERCASE_FIRST_LETTER);
|
||||||
operation.path = operation.path.replace(completeMatch, replacement);
|
operation.path = operation.path.replace(completeMatch, replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public class JavascriptApolloClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class JavascriptApolloClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -507,7 +508,7 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -840,18 +841,18 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public class JavascriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class JavascriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -492,7 +493,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -825,18 +826,18 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -179,7 +180,7 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
|
|||||||
|
|
||||||
// camelize the variable name
|
// camelize the variable name
|
||||||
// pet_id => PetId
|
// pet_id => PetId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*"))
|
if (isReservedWord(name) || name.matches("^\\d.*"))
|
||||||
@ -287,11 +288,11 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
|
|||||||
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
@ -708,7 +709,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
|
@ -42,6 +42,7 @@ import java.net.URL;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||||
@ -643,7 +644,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
|||||||
if (title.toUpperCase(Locale.ROOT).endsWith("API"))
|
if (title.toUpperCase(Locale.ROOT).endsWith("API"))
|
||||||
title = title.substring(0, title.length() - 3);
|
title = title.substring(0, title.length() - 3);
|
||||||
|
|
||||||
this.title = camelize(sanitizeName(title), true);
|
this.title = camelize(sanitizeName(title), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
additionalProperties.put(TITLE, this.title);
|
additionalProperties.put(TITLE, this.title);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -253,10 +254,10 @@ public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
String sanitizedOperationId = sanitizeName(operationId);
|
String sanitizedOperationId = sanitizeName(operationId);
|
||||||
|
|
||||||
if (isReservedWord(sanitizedOperationId)) {
|
if (isReservedWord(sanitizedOperationId)) {
|
||||||
sanitizedOperationId = "call" + StringUtils.camelize(sanitizedOperationId, false);
|
sanitizedOperationId = "call" + StringUtils.camelize(sanitizedOperationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StringUtils.camelize(sanitizedOperationId, true);
|
return StringUtils.camelize(sanitizedOperationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -320,7 +321,7 @@ public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name)) {
|
if (isReservedWord(name)) {
|
||||||
@ -350,7 +351,7 @@ public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toEnumName(CodegenProperty property) {
|
public String toEnumName(CodegenProperty property) {
|
||||||
String name = StringUtils.camelize(property.name, false);
|
String name = StringUtils.camelize(property.name);
|
||||||
|
|
||||||
if (name.matches("\\d.*")) { // starts with number
|
if (name.matches("\\d.*")) { // starts with number
|
||||||
return "`" + name + "`";
|
return "`" + name + "`";
|
||||||
@ -362,7 +363,7 @@ public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
@Override
|
@Override
|
||||||
public String toEnumVarName(String name, String datatype) {
|
public String toEnumVarName(String name, String datatype) {
|
||||||
name = name.replace(" ", "_");
|
name = name.replace(" ", "_");
|
||||||
name = StringUtils.camelize(name, false);
|
name = StringUtils.camelize(name);
|
||||||
|
|
||||||
if (name.matches("\\d.*")) { // starts with number
|
if (name.matches("\\d.*")) { // starts with number
|
||||||
return "`" + name + "`";
|
return "`" + name + "`";
|
||||||
|
@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -573,7 +574,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
// camelize (lower first character) the variable name
|
// camelize (lower first character) the variable name
|
||||||
// e.g. `pet_id` to `petId`
|
// e.g. `pet_id` to `petId`
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved word or word starting with number, prepend `_`
|
// for reserved word or word starting with number, prepend `_`
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
@ -618,11 +619,12 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
final String newName = "call_" + operationId;
|
||||||
operationId = "call_" + operationId;
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newName);
|
||||||
|
operationId = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(sanitizeName(operationId), true);
|
return camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClassPrefix(String classPrefix) {
|
public void setClassPrefix(String classPrefix) {
|
||||||
@ -677,6 +679,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the default value of the schema
|
* Return the default value of the schema
|
||||||
|
*
|
||||||
* @param p OpenAPI schema object
|
* @param p OpenAPI schema object
|
||||||
* @return string presentation of the default value of the schema
|
* @return string presentation of the default value of the schema
|
||||||
*/
|
*/
|
||||||
@ -795,5 +798,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.OBJECTIVE_C; }
|
public GeneratorLanguage generatorLanguage() {
|
||||||
|
return GeneratorLanguage.OBJECTIVE_C;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
|
|||||||
return "DefaultController";
|
return "DefaultController";
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(name, false) + "Controller";
|
return camelize(name) + "Controller";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String controllerFileFolder() {
|
protected String controllerFileFolder() {
|
||||||
@ -298,7 +298,7 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
|
|||||||
return "DefaultController";
|
return "DefaultController";
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(name, false) + "Controller";
|
return camelize(name) + "Controller";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,6 +32,7 @@ import org.openapitools.codegen.meta.Stability;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -273,7 +274,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
for (int i = 0; i < items.length; ++i) {
|
for (int i = 0; i < items.length; ++i) {
|
||||||
if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {}
|
if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {}
|
||||||
// camelize path variable
|
// camelize path variable
|
||||||
items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), true) + "}";
|
items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), LOWERCASE_FIRST_LETTER) + "}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,14 +613,14 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
|||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
return "DefaultApiInterface";
|
return "DefaultApiInterface";
|
||||||
}
|
}
|
||||||
return camelize(name, false) + "ApiInterface";
|
return camelize(name) + "ApiInterface";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String toControllerName(String name) {
|
protected String toControllerName(String name) {
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
return "DefaultController";
|
return "DefaultController";
|
||||||
}
|
}
|
||||||
return camelize(name, false) + "Controller";
|
return camelize(name) + "Controller";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String toSymfonyService(String name) {
|
protected String toSymfonyService(String name) {
|
||||||
|
@ -43,6 +43,7 @@ import java.io.Writer;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -566,7 +567,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if ("PascalCase".equals(operationIdNaming)) {
|
if ("PascalCase".equals(operationIdNaming)) {
|
||||||
return camelize(sanitizedOperationId);
|
return camelize(sanitizedOperationId);
|
||||||
} else if ("camelCase".equals(operationIdNaming)) {
|
} else if ("camelCase".equals(operationIdNaming)) {
|
||||||
return camelize(sanitizedOperationId, true);
|
return camelize(sanitizedOperationId, LOWERCASE_FIRST_LETTER);
|
||||||
} else if ("snake_case".equals(operationIdNaming)) {
|
} else if ("snake_case".equals(operationIdNaming)) {
|
||||||
return underscore(sanitizedOperationId);
|
return underscore(sanitizedOperationId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1275,7 +1275,7 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
|||||||
int position = property.dataType.lastIndexOf(":");
|
int position = property.dataType.lastIndexOf(":");
|
||||||
property.dataType = property.dataType.substring(0, position) + camelize(property.dataType.substring(position));
|
property.dataType = property.dataType.substring(0, position) + camelize(property.dataType.substring(position));
|
||||||
} else {
|
} else {
|
||||||
property.dataType = camelize(property.dataType, false);
|
property.dataType = camelize(property.dataType);
|
||||||
}
|
}
|
||||||
property.isPrimitiveType = property.isContainer && languageSpecificPrimitives.contains(typeMapping.get(property.complexType));
|
property.isPrimitiveType = property.isContainer && languageSpecificPrimitives.contains(typeMapping.get(property.complexType));
|
||||||
} else {
|
} else {
|
||||||
|
@ -302,16 +302,6 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class CustomLambda implements Mustache.Lambda {
|
|
||||||
@Override
|
|
||||||
public void execute(Template.Fragment frag, Writer out) throws IOException {
|
|
||||||
final StringWriter tempWriter = new StringWriter();
|
|
||||||
frag.execute(tempWriter);
|
|
||||||
out.write(formatFragment(tempWriter.toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String formatFragment(String fragment);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class JavadocLambda extends CustomLambda {
|
private static class JavadocLambda extends CustomLambda {
|
||||||
@Override
|
@Override
|
||||||
@ -334,19 +324,6 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CamelizeLambda extends CustomLambda {
|
|
||||||
private final boolean capitalizeFirst;
|
|
||||||
|
|
||||||
public CamelizeLambda(boolean capitalizeFirst) {
|
|
||||||
this.capitalizeFirst = capitalizeFirst;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String formatFragment(String fragment) {
|
|
||||||
return camelize(fragment, !capitalizeFirst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class EnumEntryLambda extends CustomLambda {
|
private class EnumEntryLambda extends CustomLambda {
|
||||||
@Override
|
@Override
|
||||||
public String formatFragment(String fragment) {
|
public String formatFragment(String fragment) {
|
||||||
|
@ -30,6 +30,7 @@ import java.util.Arrays;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -200,7 +201,7 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(operationId, true);
|
return camelize(operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
||||||
@ -163,7 +164,7 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod
|
|||||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(operationId, true);
|
return camelize(operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,6 +41,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.rightPad;
|
import static org.apache.commons.lang3.StringUtils.rightPad;
|
||||||
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
|
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
||||||
@ -243,7 +244,7 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem
|
|||||||
Matcher match = pathVariableMatcher.matcher(operation.path);
|
Matcher match = pathVariableMatcher.matcher(operation.path);
|
||||||
while (match.find()) {
|
while (match.find()) {
|
||||||
String completeMatch = match.group();
|
String completeMatch = match.group();
|
||||||
String replacement = ":" + camelize(match.group(1), true);
|
String replacement = ":" + camelize(match.group(1), LOWERCASE_FIRST_LETTER);
|
||||||
operation.path = operation.path.replace(completeMatch, replacement);
|
operation.path = operation.path.replace(completeMatch, replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +266,7 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem
|
|||||||
for (ModelMap mo : outer.getModels()) {
|
for (ModelMap mo : outer.getModels()) {
|
||||||
CodegenModel cm = mo.getModel();
|
CodegenModel cm = mo.getModel();
|
||||||
postProcessModelsEnum(outer);
|
postProcessModelsEnum(outer);
|
||||||
cm.classVarName = camelize(cm.classVarName, true);
|
cm.classVarName = camelize(cm.classVarName, LOWERCASE_FIRST_LETTER);
|
||||||
modelsByClassName.put(cm.classname, cm);
|
modelsByClassName.put(cm.classname, cm);
|
||||||
boolean hasFiles = cm.vars.stream().anyMatch(var -> var.isFile);
|
boolean hasFiles = cm.vars.stream().anyMatch(var -> var.isFile);
|
||||||
cm.vendorExtensions.put("x-has-files", hasFiles);
|
cm.vendorExtensions.put("x-has-files", hasFiles);
|
||||||
|
@ -32,6 +32,7 @@ import org.openapitools.codegen.model.ModelMap;
|
|||||||
import org.openapitools.codegen.model.ModelsMap;
|
import org.openapitools.codegen.model.ModelsMap;
|
||||||
import org.openapitools.codegen.model.OperationMap;
|
import org.openapitools.codegen.model.OperationMap;
|
||||||
import org.openapitools.codegen.model.OperationsMap;
|
import org.openapitools.codegen.model.OperationsMap;
|
||||||
|
import org.openapitools.codegen.utils.CamelizeOption;
|
||||||
import org.openapitools.codegen.utils.ModelUtils;
|
import org.openapitools.codegen.utils.ModelUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -44,6 +45,8 @@ import java.util.*;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.*;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
||||||
@ -560,17 +563,6 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class CustomLambda implements Mustache.Lambda {
|
|
||||||
@Override
|
|
||||||
public void execute(Template.Fragment frag, Writer out) throws IOException {
|
|
||||||
final StringWriter tempWriter = new StringWriter();
|
|
||||||
frag.execute(tempWriter);
|
|
||||||
out.write(formatFragment(tempWriter.toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String formatFragment(String fragment);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class JavadocLambda extends CustomLambda {
|
private static class JavadocLambda extends CustomLambda {
|
||||||
@Override
|
@Override
|
||||||
public String formatFragment(String fragment) {
|
public String formatFragment(String fragment) {
|
||||||
@ -592,19 +584,6 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CamelizeLambda extends CustomLambda {
|
|
||||||
private final boolean capitalizeFirst;
|
|
||||||
|
|
||||||
public CamelizeLambda(boolean capitalizeFirst) {
|
|
||||||
this.capitalizeFirst = capitalizeFirst;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String formatFragment(String fragment) {
|
|
||||||
return camelize(fragment, !capitalizeFirst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class EnumEntryLambda extends CustomLambda {
|
private class EnumEntryLambda extends CustomLambda {
|
||||||
@Override
|
@Override
|
||||||
public String formatFragment(String fragment) {
|
public String formatFragment(String fragment) {
|
||||||
|
@ -36,6 +36,7 @@ import java.util.Arrays;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -152,7 +153,7 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
@ -228,7 +229,7 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
|
|||||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(operationId, true);
|
return camelize(operationId, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class CustomLambda implements Mustache.Lambda {
|
private static abstract class CustomLambda implements Mustache.Lambda {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
import com.samskivert.mustache.Mustache;
|
import com.samskivert.mustache.Mustache;
|
||||||
@ -639,7 +640,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
title = title.substring(0, title.length() - 3);
|
title = title.substring(0, title.length() - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.title = camelize(sanitizeName(title), true);
|
this.title = camelize(sanitizeName(title), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
additionalProperties.put(TITLE, this.title);
|
additionalProperties.put(TITLE, this.title);
|
||||||
}
|
}
|
||||||
@ -767,7 +768,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
final List<CodegenSecurity> authMethods = (List<CodegenSecurity>) objs.get("authMethods");
|
final List<CodegenSecurity> authMethods = (List<CodegenSecurity>) objs.get("authMethods");
|
||||||
if (authMethods != null) {
|
if (authMethods != null) {
|
||||||
for (final CodegenSecurity authMethod : authMethods) {
|
for (final CodegenSecurity authMethod : authMethods) {
|
||||||
authMethod.name = camelize(sanitizeName(authMethod.name), true);
|
authMethod.name = camelize(sanitizeName(authMethod.name), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import java.time.Instant;
|
|||||||
import java.time.temporal.ChronoField;
|
import java.time.temporal.ChronoField;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -827,7 +828,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toOperationId(String operationId) {
|
public String toOperationId(String operationId) {
|
||||||
operationId = camelize(sanitizeName(operationId), true);
|
operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// Throw exception if method name is empty.
|
// Throw exception if method name is empty.
|
||||||
// This should not happen but keep the check just in case
|
// This should not happen but keep the check just in case
|
||||||
@ -837,15 +838,15 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize(("call_" + operationId), true);
|
String newOperationId = camelize(("call_" + operationId), LOWERCASE_FIRST_LETTER);
|
||||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
return newOperationId;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER));
|
||||||
operationId = camelize(sanitizeName("call_" + operationId), true);
|
operationId = camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -864,7 +865,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
// camelize the variable name
|
// camelize the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved words surround with `` or append _
|
// for reserved words surround with `` or append _
|
||||||
if (isReservedWord(name)) {
|
if (isReservedWord(name)) {
|
||||||
@ -894,7 +895,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
// camelize(lower) the variable name
|
// camelize(lower) the variable name
|
||||||
// pet_id => petId
|
// pet_id => petId
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
|
|
||||||
// for reserved words surround with ``
|
// for reserved words surround with ``
|
||||||
if (isReservedWord(name)) {
|
if (isReservedWord(name)) {
|
||||||
@ -1019,7 +1020,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
if (enumUnknownDefaultCase) {
|
if (enumUnknownDefaultCase) {
|
||||||
if (name.equals(enumUnknownDefaultCaseName)) {
|
if (name.equals(enumUnknownDefaultCaseName)) {
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,18 +1032,18 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
// Prefix with underscore if name starts with number
|
// Prefix with underscore if name starts with number
|
||||||
if (name.matches("\\d.*")) {
|
if (name.matches("\\d.*")) {
|
||||||
return "_" + replaceSpecialCharacters(camelize(name, true));
|
return "_" + replaceSpecialCharacters(camelize(name, LOWERCASE_FIRST_LETTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
// for symbol, e.g. $, #
|
// for symbol, e.g. $, #
|
||||||
if (getSymbolName(name) != null) {
|
if (getSymbolName(name) != null) {
|
||||||
return camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase(Locale.ROOT)), true);
|
return camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase(Locale.ROOT)), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Camelize only when we have a structure defined below
|
// Camelize only when we have a structure defined below
|
||||||
Boolean camelized = false;
|
boolean camelized = false;
|
||||||
if (name.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) {
|
if (name.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) {
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
camelized = true;
|
camelized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,7 +1063,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
char[] separators = {'-', '_', ' ', ':', '(', ')'};
|
char[] separators = {'-', '_', ' ', ':', '(', ')'};
|
||||||
return camelize(replaceSpecialCharacters(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators)
|
return camelize(replaceSpecialCharacters(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators)
|
||||||
.replaceAll("[-_ :\\(\\)]", "")),
|
.replaceAll("[-_ :\\(\\)]", "")),
|
||||||
true);
|
LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String replaceSpecialCharacters(String name) {
|
private String replaceSpecialCharacters(String name) {
|
||||||
|
@ -36,6 +36,7 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen {
|
public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||||
@ -731,7 +732,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
if ("kebab-case".equals(fileNaming)) {
|
if ("kebab-case".equals(fileNaming)) {
|
||||||
name = dashize(underscore(name));
|
name = dashize(underscore(name));
|
||||||
} else {
|
} else {
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@ -588,10 +589,10 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
// append _ at the beginning, e.g. _return
|
// append _ at the beginning, e.g. _return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
return escapeReservedWord(camelize(sanitizeName(operationId), true));
|
return escapeReservedWord(camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
return camelize(sanitizeName(operationId), true);
|
return camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModelPropertyNaming(String naming) {
|
public void setModelPropertyNaming(String naming) {
|
||||||
@ -614,7 +615,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
case original:
|
case original:
|
||||||
return name;
|
return name;
|
||||||
case camelCase:
|
case camelCase:
|
||||||
return camelize(name, true);
|
return camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
case PascalCase:
|
case PascalCase:
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
case snake_case:
|
case snake_case:
|
||||||
|
@ -31,6 +31,7 @@ import org.openapitools.codegen.model.OperationsMap;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCodegen {
|
public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||||
@ -315,7 +316,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo
|
|||||||
if (name.length() == 0) {
|
if (name.length() == 0) {
|
||||||
return "default.service";
|
return "default.service";
|
||||||
}
|
}
|
||||||
return camelize(name, true) + ".service";
|
return camelize(name, LOWERCASE_FIRST_LETTER) + ".service";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -325,7 +326,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelFilename(String name) {
|
public String toModelFilename(String name) {
|
||||||
return camelize(toModelName(name), true);
|
return camelize(toModelName(name), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,6 +33,7 @@ import java.io.File;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodegen {
|
public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||||
@ -543,7 +544,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg
|
|||||||
if ("kebab-case".equals(fileNaming)) {
|
if ("kebab-case".equals(fileNaming)) {
|
||||||
name = dashize(underscore(name));
|
name = dashize(underscore(name));
|
||||||
} else {
|
} else {
|
||||||
name = camelize(name, true);
|
name = camelize(name, LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import java.io.File;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen {
|
public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||||
@ -141,7 +142,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
if (importMapping.containsKey(name)) {
|
if (importMapping.containsKey(name)) {
|
||||||
return importMapping.get(name);
|
return importMapping.get(name);
|
||||||
}
|
}
|
||||||
return camelize(name, true) + apiSuffix;
|
return camelize(name, LOWERCASE_FIRST_LETTER) + apiSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,7 +160,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
return importMapping.get(name);
|
return importMapping.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DEFAULT_MODEL_FILENAME_DIRECTORY_PREFIX + camelize(toModelName(name), true);
|
return DEFAULT_MODEL_FILENAME_DIRECTORY_PREFIX + camelize(toModelName(name), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -168,7 +169,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
return importMapping.get(name);
|
return importMapping.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DEFAULT_MODEL_IMPORT_DIRECTORY_PREFIX + modelPackage() + "/" + camelize(toModelName(name), true);
|
return DEFAULT_MODEL_IMPORT_DIRECTORY_PREFIX + modelPackage() + "/" + camelize(toModelName(name), LOWERCASE_FIRST_LETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,10 +20,13 @@ package org.openapitools.codegen.templating.mustache;
|
|||||||
import com.samskivert.mustache.Mustache;
|
import com.samskivert.mustache.Mustache;
|
||||||
import com.samskivert.mustache.Template;
|
import com.samskivert.mustache.Template;
|
||||||
import org.openapitools.codegen.CodegenConfig;
|
import org.openapitools.codegen.CodegenConfig;
|
||||||
|
import org.openapitools.codegen.utils.CamelizeOption;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,10 +45,14 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
|
|||||||
public class CamelCaseLambda implements Mustache.Lambda {
|
public class CamelCaseLambda implements Mustache.Lambda {
|
||||||
private CodegenConfig generator = null;
|
private CodegenConfig generator = null;
|
||||||
private Boolean escapeParam = false;
|
private Boolean escapeParam = false;
|
||||||
private Boolean lowercaseFirstLetter = true;
|
private CamelizeOption option = LOWERCASE_FIRST_LETTER;
|
||||||
|
|
||||||
public CamelCaseLambda(boolean lowercaseFirstLetter) {
|
public CamelCaseLambda(boolean lowercaseFirstLetter) {
|
||||||
this.lowercaseFirstLetter = lowercaseFirstLetter;
|
if (lowercaseFirstLetter) {
|
||||||
|
option = LOWERCASE_FIRST_LETTER;
|
||||||
|
} else {
|
||||||
|
option = UPPERCASE_FIRST_CHAR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CamelCaseLambda() {}
|
public CamelCaseLambda() {}
|
||||||
@ -62,7 +69,7 @@ public class CamelCaseLambda implements Mustache.Lambda {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||||
String text = camelize(fragment.execute().replace(" ", "_"), lowercaseFirstLetter);
|
String text = camelize(fragment.execute().replace(" ", "_"), option);
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
text = generator.sanitizeName(text);
|
text = generator.sanitizeName(text);
|
||||||
if (generator.reservedWords().contains(text)) {
|
if (generator.reservedWords().contains(text)) {
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package org.openapitools.codegen.utils;
|
||||||
|
|
||||||
|
public enum CamelizeOption {
|
||||||
|
UPPERCASE_FIRST_CHAR,
|
||||||
|
LOWERCASE_FIRST_LETTER,
|
||||||
|
LOWERCASE_FIRST_CHAR
|
||||||
|
}
|
@ -17,6 +17,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||||
|
|
||||||
public class StringUtils {
|
public class StringUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +32,7 @@ public class StringUtils {
|
|||||||
|
|
||||||
// A cache of camelized words. The camelize() method is invoked many times with the same
|
// A cache of camelized words. The camelize() method is invoked many times with the same
|
||||||
// arguments, this cache is used to optimized performance.
|
// arguments, this cache is used to optimized performance.
|
||||||
private static Cache<Pair<String, Boolean>, String> camelizedWordsCache;
|
private static Cache<Pair<String, CamelizeOption>, String> camelizedWordsCache;
|
||||||
|
|
||||||
// A cache of underscored words, used to optimize the performance of the underscore() method.
|
// A cache of underscored words, used to optimize the performance of the underscore() method.
|
||||||
private static Cache<String, String> underscoreWordsCache;
|
private static Cache<String, String> underscoreWordsCache;
|
||||||
@ -111,7 +113,7 @@ public class StringUtils {
|
|||||||
* @return camelized string
|
* @return camelized string
|
||||||
*/
|
*/
|
||||||
public static String camelize(String word) {
|
public static String camelize(String word) {
|
||||||
return camelize(word, false);
|
return camelize(word, UPPERCASE_FIRST_CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Pattern camelizeSlashPattern = Pattern.compile("\\/(.?)");
|
private static Pattern camelizeSlashPattern = Pattern.compile("\\/(.?)");
|
||||||
@ -124,16 +126,16 @@ public class StringUtils {
|
|||||||
/**
|
/**
|
||||||
* Camelize name (parameter, property, method, etc)
|
* Camelize name (parameter, property, method, etc)
|
||||||
*
|
*
|
||||||
* @param inputWord string to be camelize
|
* @param inputWord string to be camelize
|
||||||
* @param lowercaseFirstLetter lower case for first letter if set to true
|
* @param camelizeOption option for the camelize result
|
||||||
* @return camelized string
|
* @return camelized string
|
||||||
*/
|
*/
|
||||||
public static String camelize(final String inputWord, boolean lowercaseFirstLetter) {
|
public static String camelize(final String inputWord, CamelizeOption camelizeOption) {
|
||||||
Pair<String, Boolean> key = new ImmutablePair<>(inputWord, lowercaseFirstLetter);
|
Pair<String, CamelizeOption> key = new ImmutablePair<>(inputWord, camelizeOption);
|
||||||
|
|
||||||
return camelizedWordsCache.get(key, pair -> {
|
return camelizedWordsCache.get(key, pair -> {
|
||||||
String word = pair.getKey();
|
String word = pair.getKey();
|
||||||
Boolean lowerFirstLetter = pair.getValue();
|
CamelizeOption option = pair.getValue();
|
||||||
// Replace all slashes with dots (package separator)
|
// Replace all slashes with dots (package separator)
|
||||||
Matcher m = camelizeSlashPattern.matcher(word);
|
Matcher m = camelizeSlashPattern.matcher(word);
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
@ -185,15 +187,13 @@ public class StringUtils {
|
|||||||
m = camelizeHyphenPattern.matcher(word);
|
m = camelizeHyphenPattern.matcher(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowerFirstLetter && word.length() > 0) {
|
switch (option) {
|
||||||
int i = 0;
|
case LOWERCASE_FIRST_LETTER:
|
||||||
char charAt = word.charAt(i);
|
word = lowercaseFirstLetter(word);
|
||||||
while (i + 1 < word.length() && !((charAt >= 'a' && charAt <= 'z') || (charAt >= 'A' && charAt <= 'Z'))) {
|
break;
|
||||||
i = i + 1;
|
case LOWERCASE_FIRST_CHAR:
|
||||||
charAt = word.charAt(i);
|
word = word.substring(0, 1).toLowerCase(Locale.ROOT) + word.substring(1);
|
||||||
}
|
break;
|
||||||
i = i + 1;
|
|
||||||
word = word.substring(0, i).toLowerCase(Locale.ROOT) + word.substring(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove all underscore
|
// remove all underscore
|
||||||
@ -202,6 +202,20 @@ public class StringUtils {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String lowercaseFirstLetter(String word) {
|
||||||
|
if (word.length() > 0) {
|
||||||
|
int i = 0;
|
||||||
|
char charAt = word.charAt(i);
|
||||||
|
while (i + 1 < word.length() && !((charAt >= 'a' && charAt <= 'z') || (charAt >= 'A' && charAt <= 'Z'))) {
|
||||||
|
i = i + 1;
|
||||||
|
charAt = word.charAt(i);
|
||||||
|
}
|
||||||
|
i = i + 1;
|
||||||
|
word = word.substring(0, i).toLowerCase(Locale.ROOT) + word.substring(i);
|
||||||
|
}
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
|
||||||
private static class EscapedNameOptions {
|
private static class EscapedNameOptions {
|
||||||
public EscapedNameOptions(String name, Set<String> specialChars, List<String> charactersToAllow, String appendToReplacement) {
|
public EscapedNameOptions(String name, Set<String> specialChars, List<String> charactersToAllow, String appendToReplacement) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -103,7 +103,7 @@ public class AbstractJavaCodegenTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertVarName() throws Exception {
|
public void convertVarName() {
|
||||||
Assert.assertEquals(fakeJavaCodegen.toVarName("name"), "name");
|
Assert.assertEquals(fakeJavaCodegen.toVarName("name"), "name");
|
||||||
Assert.assertEquals(fakeJavaCodegen.toVarName("$name"), "$name");
|
Assert.assertEquals(fakeJavaCodegen.toVarName("$name"), "$name");
|
||||||
Assert.assertEquals(fakeJavaCodegen.toVarName("nam$$e"), "nam$$e");
|
Assert.assertEquals(fakeJavaCodegen.toVarName("nam$$e"), "nam$$e");
|
||||||
@ -119,10 +119,15 @@ public class AbstractJavaCodegenTest {
|
|||||||
Assert.assertEquals(fakeJavaCodegen.toVarName("1A"), "_1A");
|
Assert.assertEquals(fakeJavaCodegen.toVarName("1A"), "_1A");
|
||||||
Assert.assertEquals(fakeJavaCodegen.toVarName("1AAAA"), "_1AAAA");
|
Assert.assertEquals(fakeJavaCodegen.toVarName("1AAAA"), "_1AAAA");
|
||||||
Assert.assertEquals(fakeJavaCodegen.toVarName("1AAaa"), "_1aAaa");
|
Assert.assertEquals(fakeJavaCodegen.toVarName("1AAaa"), "_1aAaa");
|
||||||
|
|
||||||
|
AbstractJavaCodegen withCaml = new P_AbstractJavaCodegen();
|
||||||
|
withCaml.setCamelCaseDollarSign(true);
|
||||||
|
Assert.assertEquals(withCaml.toVarName("$name"), "$Name");
|
||||||
|
Assert.assertEquals(withCaml.toVarName("1AAaa"), "_1AAaa");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertModelName() throws Exception {
|
public void convertModelName() {
|
||||||
Assert.assertEquals(fakeJavaCodegen.toModelName("name"), "Name");
|
Assert.assertEquals(fakeJavaCodegen.toModelName("name"), "Name");
|
||||||
Assert.assertEquals(fakeJavaCodegen.toModelName("$name"), "Name");
|
Assert.assertEquals(fakeJavaCodegen.toModelName("$name"), "Name");
|
||||||
Assert.assertEquals(fakeJavaCodegen.toModelName("nam#e"), "Name");
|
Assert.assertEquals(fakeJavaCodegen.toModelName("nam#e"), "Name");
|
||||||
|
@ -66,7 +66,7 @@ public class KotlinReservedWordsTest {
|
|||||||
final DefaultCodegen codegen = new KotlinClientCodegen();
|
final DefaultCodegen codegen = new KotlinClientCodegen();
|
||||||
final Schema schema = new Schema();
|
final Schema schema = new Schema();
|
||||||
final String escaped = "`" + reservedWord + "`";
|
final String escaped = "`" + reservedWord + "`";
|
||||||
final String titleCased = StringUtils.camelize(reservedWord, false);
|
final String titleCased = StringUtils.camelize(reservedWord);
|
||||||
|
|
||||||
codegen.setOpenAPI(openAPI);
|
codegen.setOpenAPI(openAPI);
|
||||||
CodegenModel model = codegen.fromModel(reservedWord, schema);
|
CodegenModel model = codegen.fromModel(reservedWord, schema);
|
||||||
@ -106,7 +106,7 @@ public class KotlinReservedWordsTest {
|
|||||||
final DefaultCodegen codegen = new KotlinClientCodegen();
|
final DefaultCodegen codegen = new KotlinClientCodegen();
|
||||||
|
|
||||||
final String escaped = "`" + reservedWord + "`";
|
final String escaped = "`" + reservedWord + "`";
|
||||||
final String titleCased = StringUtils.camelize(reservedWord, false);
|
final String titleCased = StringUtils.camelize(reservedWord);
|
||||||
|
|
||||||
Schema linked = openAPI.getComponents().getSchemas().get("Linked");
|
Schema linked = openAPI.getComponents().getSchemas().get("Linked");
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package org.openapitools.codegen.utils;
|
|||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_CHAR;
|
||||||
|
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
|
|
||||||
public class StringUtilsTest {
|
public class StringUtilsTest {
|
||||||
@ -21,14 +23,18 @@ public class StringUtilsTest {
|
|||||||
Assert.assertEquals(camelize("some_value"), "SomeValue");
|
Assert.assertEquals(camelize("some_value"), "SomeValue");
|
||||||
Assert.assertEquals(camelize("$type"), "$Type");
|
Assert.assertEquals(camelize("$type"), "$Type");
|
||||||
|
|
||||||
Assert.assertEquals(camelize("abcd", true), "abcd");
|
Assert.assertEquals(camelize("abcd", LOWERCASE_FIRST_LETTER), "abcd");
|
||||||
Assert.assertEquals(camelize("some-value", true), "someValue");
|
Assert.assertEquals(camelize("some-value", LOWERCASE_FIRST_LETTER), "someValue");
|
||||||
Assert.assertEquals(camelize("some_value", true), "someValue");
|
Assert.assertEquals(camelize("some_value", LOWERCASE_FIRST_LETTER), "someValue");
|
||||||
Assert.assertEquals(camelize("Abcd", true), "abcd");
|
Assert.assertEquals(camelize("Abcd", LOWERCASE_FIRST_LETTER), "abcd");
|
||||||
Assert.assertEquals(camelize("$type", true), "$type");
|
Assert.assertEquals(camelize("$type", LOWERCASE_FIRST_LETTER), "$type");
|
||||||
|
|
||||||
Assert.assertEquals(camelize("123", true), "123");
|
Assert.assertEquals(camelize("123", LOWERCASE_FIRST_LETTER), "123");
|
||||||
Assert.assertEquals(camelize("$123", true), "$123");
|
Assert.assertEquals(camelize("$123", LOWERCASE_FIRST_LETTER), "$123");
|
||||||
|
|
||||||
|
|
||||||
|
Assert.assertEquals(camelize("some-value", LOWERCASE_FIRST_CHAR), "someValue");
|
||||||
|
Assert.assertEquals(camelize("$type", LOWERCASE_FIRST_CHAR), "$Type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -77,9 +77,9 @@ public class Model200Response {
|
|||||||
if (o == null || getClass() != o.getClass()) {
|
if (o == null || getClass() != o.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Model200Response _200response = (Model200Response) o;
|
Model200Response _200Response = (Model200Response) o;
|
||||||
return Objects.equals(this.name, _200response.name) &&
|
return Objects.equals(this.name, _200Response.name) &&
|
||||||
Objects.equals(this.propertyClass, _200response.propertyClass);
|
Objects.equals(this.propertyClass, _200Response.propertyClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,25 +25,25 @@ import javax.annotation.Generated;
|
|||||||
public class ModelList {
|
public class ModelList {
|
||||||
|
|
||||||
@JsonProperty("123-list")
|
@JsonProperty("123-list")
|
||||||
private String _123list;
|
private String _123List;
|
||||||
|
|
||||||
public ModelList _123list(String _123list) {
|
public ModelList _123List(String _123List) {
|
||||||
this._123list = _123list;
|
this._123List = _123List;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get _123list
|
* Get _123List
|
||||||
* @return _123list
|
* @return _123List
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
public String get123list() {
|
public String get123List() {
|
||||||
return _123list;
|
return _123List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set123list(String _123list) {
|
public void set123List(String _123List) {
|
||||||
this._123list = _123list;
|
this._123List = _123List;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,19 +55,19 @@ public class ModelList {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ModelList _list = (ModelList) o;
|
ModelList _list = (ModelList) o;
|
||||||
return Objects.equals(this._123list, _list._123list);
|
return Objects.equals(this._123List, _list._123List);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(_123list);
|
return Objects.hash(_123List);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class ModelList {\n");
|
sb.append("class ModelList {\n");
|
||||||
sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n");
|
sb.append(" _123List: ").append(toIndentedString(_123List)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class Name {
|
|||||||
private String property;
|
private String property;
|
||||||
|
|
||||||
@JsonProperty("123Number")
|
@JsonProperty("123Number")
|
||||||
private Integer _123number;
|
private Integer _123Number;
|
||||||
|
|
||||||
public Name name(Integer name) {
|
public Name name(Integer name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -92,23 +92,23 @@ public class Name {
|
|||||||
this.property = property;
|
this.property = property;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Name _123number(Integer _123number) {
|
public Name _123Number(Integer _123Number) {
|
||||||
this._123number = _123number;
|
this._123Number = _123Number;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get _123number
|
* Get _123Number
|
||||||
* @return _123number
|
* @return _123Number
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ApiModelProperty(readOnly = true, value = "")
|
@ApiModelProperty(readOnly = true, value = "")
|
||||||
public Integer get123number() {
|
public Integer get123Number() {
|
||||||
return _123number;
|
return _123Number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set123number(Integer _123number) {
|
public void set123Number(Integer _123Number) {
|
||||||
this._123number = _123number;
|
this._123Number = _123Number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,12 +123,12 @@ public class Name {
|
|||||||
return Objects.equals(this.name, name.name) &&
|
return Objects.equals(this.name, name.name) &&
|
||||||
Objects.equals(this.snakeCase, name.snakeCase) &&
|
Objects.equals(this.snakeCase, name.snakeCase) &&
|
||||||
Objects.equals(this.property, name.property) &&
|
Objects.equals(this.property, name.property) &&
|
||||||
Objects.equals(this._123number, name._123number);
|
Objects.equals(this._123Number, name._123Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(name, snakeCase, property, _123number);
|
return Objects.hash(name, snakeCase, property, _123Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -138,7 +138,7 @@ public class Name {
|
|||||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
|
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
|
||||||
sb.append(" property: ").append(toIndentedString(property)).append("\n");
|
sb.append(" property: ").append(toIndentedString(property)).append("\n");
|
||||||
sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n");
|
sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -25,25 +25,25 @@ import javax.annotation.Generated;
|
|||||||
public class SpecialModelName {
|
public class SpecialModelName {
|
||||||
|
|
||||||
@JsonProperty("$special[property.name]")
|
@JsonProperty("$special[property.name]")
|
||||||
private Long $specialPropertyName;
|
private Long $SpecialPropertyName;
|
||||||
|
|
||||||
public SpecialModelName $specialPropertyName(Long $specialPropertyName) {
|
public SpecialModelName $SpecialPropertyName(Long $SpecialPropertyName) {
|
||||||
this.$specialPropertyName = $specialPropertyName;
|
this.$SpecialPropertyName = $SpecialPropertyName;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get $specialPropertyName
|
* Get $SpecialPropertyName
|
||||||
* @return $specialPropertyName
|
* @return $SpecialPropertyName
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
public Long get$SpecialPropertyName() {
|
public Long get$SpecialPropertyName() {
|
||||||
return $specialPropertyName;
|
return $SpecialPropertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set$SpecialPropertyName(Long $specialPropertyName) {
|
public void set$SpecialPropertyName(Long $SpecialPropertyName) {
|
||||||
this.$specialPropertyName = $specialPropertyName;
|
this.$SpecialPropertyName = $SpecialPropertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,20 +54,20 @@ public class SpecialModelName {
|
|||||||
if (o == null || getClass() != o.getClass()) {
|
if (o == null || getClass() != o.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SpecialModelName $specialModelName = (SpecialModelName) o;
|
SpecialModelName $SpecialModelName = (SpecialModelName) o;
|
||||||
return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName);
|
return Objects.equals(this.$SpecialPropertyName, $SpecialModelName.$SpecialPropertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash($specialPropertyName);
|
return Objects.hash($SpecialPropertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class SpecialModelName {\n");
|
sb.append("class SpecialModelName {\n");
|
||||||
sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n");
|
sb.append(" $SpecialPropertyName: ").append(toIndentedString($SpecialPropertyName)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user