Compare commits

..

3 Commits

Author SHA1 Message Date
William Cheng
2199534829 fix 2026-01-27 12:57:03 +08:00
William Cheng
ea4d07da11 trigger build 2026-01-27 12:45:52 +08:00
William Cheng
dbba72842f update python server workflow to use v3.10 2026-01-27 12:40:02 +08:00
255 changed files with 1548 additions and 6399 deletions

View File

@@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: '3.9'
python-version: '3.10'
- name: Test
working-directory: ${{ matrix.sample }}
run: make test-all

View File

@@ -2,9 +2,3 @@ generatorName: typescript-fetch
outputDir: samples/client/petstore/typescript-fetch/builds/oneOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/oneOf.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
additionalProperties:
npmVersion: 1.0.0
npmName: '@openapitools/typescript-fetch-petstore'
npmRepository: https://skimdb.npmjs.com/registry
snapshot: false

View File

@@ -723,10 +723,3 @@ Into this securityScheme:
scheme: bearer
type: http
```
- `SORT_MODEL_PROPERTIES`: When set to true, model properties will be sorted alphabetically by name. This ensures deterministic code generation output regardless of property ordering in the source spec.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java-okhttp/ --openapi-normalizer SORT_MODEL_PROPERTIES=true
```

View File

@@ -30,7 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|containerDefaultToNull|Set containers (array, set, map) default to null| |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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|containerDefaultToNull|Set containers (array, set, map) default to null| |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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -33,7 +33,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configKey|Config key in @RegisterRestClient. Default to none.| |null|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -41,7 +41,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|datetimeFormat|Specify the format pattern of date-time as a string| |null|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -36,7 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|datetimeFormat|Specify the format pattern of date-time as a string| |null|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -37,7 +37,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configKeyFromClassName|If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.| |null|
|containerDefaultToNull|Set containers (array, set, map) default to null| |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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -33,7 +33,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -35,7 +35,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|containerDefaultToNull|Set containers (array, set, map) default to null| |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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -37,7 +37,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configKeyFromClassName|If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.| |null|
|containerDefaultToNull|Set containers (array, set, map) default to null| |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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -33,7 +33,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -32,7 +32,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|

View File

@@ -22,7 +22,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|aggregateModelsName|Aggregated model filename. If set, all generated models will be combined into this single file.| |null|
|customOptionsApi|Custom options for the api files.| |null|
|customOptionsModel|Custom options for the model files.| |null|
|extractEnumsToSeparateFiles|Extract enums to separate protobuf files and import them in models| |false|
|numberedFieldNumberList|Field numbers in order.| |false|
|startEnumsWithUnspecified|Introduces &quot;UNSPECIFIED&quot; as the first element of enumerations.| |false|
|supportMultipleResponses|Support multiple responses| |true|

View File

@@ -10,7 +10,7 @@ title: Documentation for the python-fastapi Generator
| generator stability | BETA | |
| generator type | SERVER | |
| generator language | Python | |
| generator language version | 3.10 | |
| generator language version | 3.7 | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python FastAPI server (beta). Models are defined with the pydantic library | |

View File

@@ -37,7 +37,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|containerDefaultToNull|Set containers (array, set, map) default to null| |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|
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -456,7 +456,6 @@ public class CodegenConstants {
public static final String USE_DEFAULT_VALUES_FOR_REQUIRED_VARS = "useDefaultValuesForRequiredVars";
public static final String DEFAULT_TO_EMPTY_CONTAINER = "defaultToEmptyContainer";
public static final String DEFAULT_TO_EMPTY_CONTAINER_DESC = "Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values";
// Vendor extensions
public static final String X_INTERNAL = "x-internal";

View File

@@ -88,10 +88,6 @@ public class CodegenDiscriminator {
this.explicitMapping = explicitMapping;
}
public boolean isExplicitMapping() {
return explicitMapping;
}
public MappedModel(String mappingName, String modelName) {
this(mappingName, modelName, false);
}

View File

@@ -151,9 +151,6 @@ public class OpenAPINormalizer {
boolean updateNumberToNullable;
boolean updateBooleanToNullable;
// when set to true, sort model properties by name to ensure deterministic output
final String SORT_MODEL_PROPERTIES = "SORT_MODEL_PROPERTIES";
// ============= end of rules =============
/**
@@ -212,7 +209,6 @@ public class OpenAPINormalizer {
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
ruleNames.add(SIMPLIFY_ONEOF_ANYOF_ENUM);
ruleNames.add(REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT);
ruleNames.add(SORT_MODEL_PROPERTIES);
// rules that are default to true
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
@@ -772,7 +768,7 @@ public class OpenAPINormalizer {
}
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
normalizeProperties(schema, visitedSchemas);
normalizeProperties(schema.getProperties(), visitedSchemas);
}
if (schema.getAdditionalProperties() != null) {
@@ -781,7 +777,7 @@ public class OpenAPINormalizer {
return schema;
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
normalizeProperties(schema, visitedSchemas);
normalizeProperties(schema.getProperties(), visitedSchemas);
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
normalizeMapSchema(schema);
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
@@ -884,19 +880,10 @@ public class OpenAPINormalizer {
processSetPrimitiveTypesToNullable(schema);
}
protected void normalizeProperties(Schema schema, Set<Schema> visitedSchemas) {
Map<String, Schema> properties = schema.getProperties();
protected void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
if (properties == null) {
return;
}
// Sort properties by name if rule is enabled
if (getRule(SORT_MODEL_PROPERTIES)) {
Map<String, Schema> sortedProperties = new TreeMap<>(properties);
schema.setProperties(sortedProperties);
properties = sortedProperties;
}
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
Schema property = propertiesEntry.getValue();
@@ -1102,7 +1089,7 @@ public class OpenAPINormalizer {
protected Schema normalizeComplexComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
// loop through properties, if any
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
normalizeProperties(schema, visitedSchemas);
normalizeProperties(schema.getProperties(), visitedSchemas);
}
processRemoveAnyOfOneOfAndKeepPropertiesOnly(schema);

View File

@@ -378,8 +378,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_DESC);
cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name()));
cliOptions.add(CliOption.newString(CodegenConstants.DEFAULT_TO_EMPTY_CONTAINER, CodegenConstants.DEFAULT_TO_EMPTY_CONTAINER_DESC));
}
@Override

View File

@@ -608,7 +608,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
} else if (codegenParameter.isPrimitiveType) { // primitive type
if (codegenParameter.isString) {
if (!StringUtils.isEmpty(codegenParameter.example) && !"null".equals(codegenParameter.example)) {
return "\"" + escapeText(codegenParameter.example) + "\"";
return "\"" + codegenParameter.example + "\"";
} else {
return "\"" + codegenParameter.paramName + "_example\"";
}
@@ -640,7 +640,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, processedModelMap, 0);
} else if (codegenParameter.isEmail) { // email
if (!StringUtils.isEmpty(codegenParameter.example) && !"null".equals(codegenParameter.example)) {
return "\"" + escapeText(codegenParameter.example) + "\"";
return "\"" + codegenParameter.example + "\"";
} else {
return "\"" + codegenParameter.paramName + "@example.com\"";
}
@@ -681,7 +681,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
} else if (codegenProperty.isPrimitiveType) { // primitive type
if (codegenProperty.isString) {
if (!StringUtils.isEmpty(codegenProperty.example) && !"null".equals(codegenProperty.example)) {
return "\"" + escapeText(codegenProperty.example) + "\"";
return "\"" + codegenProperty.example + "\"";
} else {
return "\"" + codegenProperty.name + "_example\"";
}
@@ -714,7 +714,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, processedModelMap, depth + 1);
} else if (codegenProperty.isEmail) { // email
if (!StringUtils.isEmpty(codegenProperty.example) && !"null".equals(codegenProperty.example)) {
return "\"" + escapeText(codegenProperty.example) + "\"";
return "\"" + codegenProperty.example + "\"";
} else {
return "\"" + codegenProperty.name + "@example.com\"";
}

View File

@@ -214,11 +214,7 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
String phpReturnType = String.join("|", phpReturnTypeOptions);
String docReturnType = String.join("|", docReturnTypeOptions);
if (hasEmptyResponse) {
if (phpReturnTypeOptions.size() > 1) {
phpReturnType = phpReturnType + "|null";
} else {
phpReturnType = "?" + phpReturnType;
}
phpReturnType = "?" + phpReturnType;
docReturnType = docReturnType + "|null";
}

View File

@@ -330,7 +330,7 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen {
@Override
public String generatorLanguageVersion() {
return "3.10";
return "3.7";
}
@Override

View File

@@ -601,7 +601,6 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
public ModelsMap postProcessModels(ModelsMap objs) {
for (ModelMap mo : objs.getModels()) {
CodegenModel cm = mo.getModel();
boolean needsExtractSimpleType = false;
for (CodegenProperty var : cm.vars) {
// check to see if base name is an empty string
if ("".equals(var.baseName)) {
@@ -609,17 +608,10 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
var.baseName = "empty_string";
}
if (!var.isPrimitiveType) {
needsExtractSimpleType = true;
}
// create extension x-r-doc-type to store the data type in r doc format
var.vendorExtensions.put("x-r-doc-type", constructRdocType(var));
}
// create extension x-r-has-non-primitive-field to indicate whether generated models need special handling for complex types
cm.vendorExtensions.put("x-r-has-non-primitive-field", needsExtractSimpleType);
// apply the same fix, enhancement for allVars
for (CodegenProperty var : cm.allVars) {
// check to see if base name is an empty string

View File

@@ -311,7 +311,7 @@
{{/useJakartaEe}}
<threetenbp-version>2.9.10</threetenbp-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<assertj-version>3.27.7</assertj-version>
<assertj-version>3.23.1</assertj-version>
<junit-version>5.10.2</junit-version>
</properties>
</project>

View File

@@ -784,7 +784,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
break;
} catch (HttpServerErrorException | HttpClientErrorException ex) {
if (ex instanceof HttpServerErrorException
|| ex.getStatusCode().equals(HttpStatus.TOO_MANY_REQUESTS)) {
|| ((HttpClientErrorException) ex)
.getStatusCode()
.equals(HttpStatus.TOO_MANY_REQUESTS)) {
attempts++;
if (attempts < maxAttemptsForRetry) {
try {

View File

@@ -6,8 +6,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
/**
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
*/
{{>generatedAnnotation}}
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
{{#gson}}
{{#allowableValues}}{{#enumVars}}

View File

@@ -176,7 +176,7 @@ import {{packageName}}.infrastructure.ITransformForStorage
override fun deserialize(decoder: Decoder): {{nameInPascalCase}} {
val value = decoder.decodeSerializableValue({{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}.serializer())
return {{nameInPascalCase}}.entries.firstOrNull { it.value == value }
return {{nameInPascalCase}}.values().firstOrNull { it.value == value }
?: {{nameInPascalCase}}.{{#allowableValues}}{{#enumVars}}{{#-last}}{{&name}}{{/-last}}{{/enumVars}}{{/allowableValues}}
}
@@ -360,14 +360,14 @@ import {{packageName}}.infrastructure.ITransformForStorage
{{#isEnum}}
{{#required}}
// validate the required field `{{{baseName}}}`
require({{{datatypeWithEnum}}}.entries.any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
require({{{datatypeWithEnum}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{datatypeWithEnum}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString())
}
{{/required}}
{{^required}}
// validate the optional field `{{{baseName}}}`
if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) {
require({{{datatypeWithEnum}}}.entries.any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
require({{{datatypeWithEnum}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{datatypeWithEnum}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString())
}
}
@@ -376,14 +376,14 @@ import {{packageName}}.infrastructure.ITransformForStorage
{{#isEnumRef}}
{{#required}}
// validate the required field `{{{baseName}}}`
require({{{dataType}}}.entries.any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
require({{{dataType}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{dataType}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString())
}
{{/required}}
{{^required}}
// validate the optional field `{{{baseName}}}`
if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null && !jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].isJsonNull) {
require({{{dataType}}}.entries.any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
require({{{dataType}}}.values().any { it.value == jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].asString }) {
String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be valid `{{{dataType}}}` enum value in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString())
}
}

View File

@@ -21,4 +21,4 @@
{{#deprecated}}
@Deprecated(message = "This property is deprecated.")
{{/deprecated}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}{{#uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}Set{{/uniqueItems}}{{^uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}}

View File

@@ -21,4 +21,4 @@
{{#deprecated}}
@Deprecated(message = "This property is deprecated.")
{{/deprecated}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}{{#uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}Set{{/uniqueItems}}{{^uniqueItems}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}}

View File

@@ -109,7 +109,7 @@ import kotlinx.serialization.*
{{^jackson}}
{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}fun decode(data: kotlin.Any?): {{classname}}? = data?.let {
val normalizedData = "$it".lowercase()
entries.firstOrNull { value ->
values().firstOrNull { value ->
it == value || normalizedData == "$value".lowercase()
}
}
@@ -127,7 +127,7 @@ import kotlinx.serialization.*
{{/isNullable}}
}
val normalizedData = "$data".lowercase()
return entries.firstOrNull { value ->
return values().firstOrNull { value ->
data == value || normalizedData == "$value".lowercase()
}{{#isNullable}}{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}
?: {{#allowableValues}}{{#enumVars}}{{#-last}}{{&name}}{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}
@@ -142,7 +142,7 @@ internal object {{classname}}Serializer : KSerializer<{{classname}}> {
override fun deserialize(decoder: Decoder): {{classname}} {
val value = decoder.decodeSerializableValue({{{dataType}}}.serializer())
return {{classname}}.entries.firstOrNull { it.value == value }
return {{classname}}.values().firstOrNull { it.value == value }
{{#isString}}
?: {{classname}}.{{#allowableValues}}{{#enumVars}}{{#-last}}{{&name}}{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/isString}}
@@ -162,7 +162,7 @@ internal object {{classname}}Serializer : KSerializer<{{classname}}> {
override fun deserialize(decoder: Decoder): {{classname}} {
val value = decoder.decodeSerializableValue({{{dataType}}}.serializer())
return {{classname}}.entries.firstOrNull { it.value == value }
return {{classname}}.values().firstOrNull { it.value == value }
?: throw IllegalArgumentException("Unknown enum value: $value")
}

View File

@@ -15,4 +15,4 @@
{{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}")
{{/kotlinx_serialization}}
{{/multiplatform}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") abstract {{/multiplatform}}{{#kotlinx_serialization}}abstract {{/kotlinx_serialization}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}?
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") abstract {{/multiplatform}}{{#kotlinx_serialization}}abstract {{/kotlinx_serialization}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}?

View File

@@ -15,4 +15,4 @@
{{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}")
{{/kotlinx_serialization}}
{{/multiplatform}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required abstract {{/multiplatform}}{{#kotlinx_serialization}}abstract {{/kotlinx_serialization}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required abstract {{/multiplatform}}{{#kotlinx_serialization}}abstract {{/kotlinx_serialization}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}

View File

@@ -1,26 +1,7 @@
{{!
Generates an extracted enum wrapped in a message container.
This wrapper pattern is used to prevent enum value name collisions
in the Protocol Buffers global enum namespace. Multiple enums can
have values with the same name when wrapped in separate messages.
Generated format:
message EnumName {
enum Enum {
VALUE1 = 0;
VALUE2 = 1;
}
}
Usage in models: EnumName.Enum field_name = 1;
}}
message {{classname}} {
enum Enum {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = {{{protobuf-enum-index}}};
{{/enumVars}}
{{/allowableValues}}
}
enum {{classname}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = {{{protobuf-enum-index}}};
{{/enumVars}}
{{/allowableValues}}
}

View File

@@ -37,7 +37,6 @@ import public "{{{.}}}.proto";
{{#vendorExtensions.x-protobuf-type}}{{{.}}} {{/vendorExtensions.x-protobuf-type}}{{{vendorExtensions.x-protobuf-data-type}}} {{{name}}} = {{vendorExtensions.x-protobuf-index}}{{#vendorExtensions.x-protobuf-packed}} [packed=true]{{/vendorExtensions.x-protobuf-packed}}{{#vendorExtensions.x-protobuf-json-name}} [json_name="{{vendorExtensions.x-protobuf-json-name}}"]{{/vendorExtensions.x-protobuf-json-name}};
{{/isEnum}}
{{#isEnum}}
{{^vendorExtensions.x-protobuf-enum-reference-import}}
enum {{enumName}} {
{{#allowableValues}}
{{#enumVars}}
@@ -46,8 +45,7 @@ import public "{{{.}}}.proto";
{{/allowableValues}}
}
{{/vendorExtensions.x-protobuf-enum-reference-import}}
{{#vendorExtensions.x-protobuf-type}}{{{.}}} {{/vendorExtensions.x-protobuf-type}}{{{vendorExtensions.x-protobuf-data-type}}} {{name}} = {{vendorExtensions.x-protobuf-index}};
{{enumName}} {{name}} = {{vendorExtensions.x-protobuf-index}};
{{/isEnum}}
{{/vars}}

View File

@@ -242,7 +242,7 @@
self$`{{name}}`
{{/isPrimitiveType}}
{{^isPrimitiveType}}
self$extractSimpleType(self$`{{name}}`)
lapply(self$`{{name}}`, function(x) x$toSimpleType())
{{/isPrimitiveType}}
{{/isArray}}
{{#isMap}}
@@ -250,7 +250,7 @@
self$`{{name}}`
{{/isPrimitiveType}}
{{^isPrimitiveType}}
self$extractSimpleType(self$`{{name}}`)
lapply(self$`{{name}}`, function(x) x$toSimpleType())
{{/isPrimitiveType}}
{{/isMap}}
{{/isContainer}}
@@ -259,7 +259,7 @@
self$`{{name}}`
{{/isPrimitiveType}}
{{^isPrimitiveType}}
self$extractSimpleType(self$`{{name}}`)
self$`{{name}}`$toSimpleType()
{{/isPrimitiveType}}
{{/isContainer}}
}
@@ -272,31 +272,6 @@
{{/isAdditionalPropertiesTrue}}
return({{classname}}Object)
},
{{#vendorExtensions.x-r-has-non-primitive-field}}
extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},
hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},
{{/vendorExtensions.x-r-has-non-primitive-field}}
#' @description
#' Deserialize JSON string into an instance of {{{classname}}}

View File

@@ -70,15 +70,15 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
{{#items}}
{{#isDateType}}
if (Array.isArray(json)) {
if (json.every(item => !(isNaN(new Date(item).getTime())))) {
return json.map(value => new Date(value));
if (json.every(item => !(isNaN(new Date(json).getTime()))) {
return json.map(value => new Date(json);
}
}
{{/isDateType}}
{{#isDateTimeType}}
if (Array.isArray(json)) {
if (json.every(item => !(isNaN(new Date(item).getTime())))) {
return json.map(value => new Date(value));
if (json.every(item => !(isNaN(new Date(json).getTime()))) {
return json.map(value => new Date(json);
}
}
{{/isDateTimeType}}
@@ -188,14 +188,14 @@ export function {{classname}}ToJSONTyped(value?: {{classname}} | null, ignoreDis
{{#isDateType}}
if (Array.isArray(value)) {
if (value.every(item => item instanceof Date) {
return value.map(value => value.toISOString().substring(0,10));
return value.map(value => value.toISOString().substring(0,10)));
}
}
{{/isDateType}}
{{#isDateTimeType}}
if (Array.isArray(value)) {
if (value.every(item => item instanceof Date)) {
return value.map(item => item.toISOString());
if (value.every(item => item instanceof Date) {
return value.map(value => value.toISOString();
}
}
{{/isDateTimeType}}

View File

@@ -216,11 +216,6 @@ export class RequestContext {
export interface ResponseBody {
text(): Promise<string>;
binary(): Promise<{{{fileContentDataType}}}>;
{{#platforms}}
{{#node}}
stream(): ReadableStream<Uint8Array> | null;
{{/node}}
{{/platforms}}
}
/**
@@ -258,14 +253,6 @@ export class SelfDecodingBody implements ResponseBody {
{{/deno}}
{{/platforms}}
}
{{#platforms}}
{{#node}}
stream(): ReadableStream<Uint8Array> | null {
return null;
}
{{/node}}
{{/platforms}}
}
export class ResponseContext {

View File

@@ -38,8 +38,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
{{#node}}
const body = {
text: () => resp.text(),
binary: () => resp.buffer(),
stream: () => resp.body
binary: () => resp.buffer()
};
{{/node}}
{{^node}}

View File

@@ -1306,59 +1306,6 @@ public class OpenAPINormalizerTest {
assertNotNull(inlinePropertyAfter.getProperties().get("nestedNumber"));
}
@Test
public void testSortModelProperties() {
// Create a schema with properties in non-alphabetical order
Schema schema = new ObjectSchema()
.addProperty("zebra", new StringSchema())
.addProperty("apple", new StringSchema())
.addProperty("mango", new IntegerSchema());
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("TestModel", schema);
// Verify original order (LinkedHashMap preserves insertion order)
List<String> originalOrder = new ArrayList<>(schema.getProperties().keySet());
assertEquals(originalOrder.get(0), "zebra");
assertEquals(originalOrder.get(1), "apple");
assertEquals(originalOrder.get(2), "mango");
// Apply normalizer with SORT_MODEL_PROPERTIES=true
Map<String, String> options = new HashMap<>();
options.put("SORT_MODEL_PROPERTIES", "true");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
// Verify properties are now sorted alphabetically
Schema normalizedSchema = openAPI.getComponents().getSchemas().get("TestModel");
List<String> sortedOrder = new ArrayList<>(normalizedSchema.getProperties().keySet());
assertEquals(sortedOrder.get(0), "apple");
assertEquals(sortedOrder.get(1), "mango");
assertEquals(sortedOrder.get(2), "zebra");
}
@Test
public void testSortModelPropertiesDisabledByDefault() {
// Create a schema with properties in non-alphabetical order
Schema schema = new ObjectSchema()
.addProperty("zebra", new StringSchema())
.addProperty("apple", new StringSchema())
.addProperty("mango", new IntegerSchema());
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("TestModel", schema);
// Apply normalizer without SORT_MODEL_PROPERTIES (default is false)
Map<String, String> options = new HashMap<>();
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
// Verify properties retain original order
Schema normalizedSchema = openAPI.getComponents().getSchemas().get("TestModel");
List<String> order = new ArrayList<>(normalizedSchema.getProperties().keySet());
assertEquals(order.get(0), "zebra");
assertEquals(order.get(1), "apple");
assertEquals(order.get(2), "mango");
}
public static class RemoveRequiredNormalizer extends OpenAPINormalizer {
public RemoveRequiredNormalizer(OpenAPI openAPI, Map<String, String> inputRules) {

View File

@@ -461,27 +461,4 @@ public class GoClientCodegenTest {
TestUtils.assertFileContains(apiPath, defaultEnumArrayString);
TestUtils.assertFileContains(apiPath, defaultValueString);
}
@Test
public void testEscapingInExamples() throws IOException {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("go")
.setInputSpec("src/test/resources/3_0/go/petstore-with-special-chars-in-examples.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
files.forEach(File::deleteOnExit);
Path docPath = Paths.get(output + "/docs/TestAPI.md");
// Verify that quotes are properly escaped in parameter examples
TestUtils.assertFileContains(docPath, "stringWithQuotes := \"John \\\"Johnny\\\" Doe\"");
// Verify that backslashes are properly escaped in parameter examples
TestUtils.assertFileContains(docPath, "stringWithBackslash := \"C:\\\\path\\\\to\\\\file\"");
// Verify that quotes are properly escaped in email parameter examples
TestUtils.assertFileContains(docPath, "emailWithQuotes := \"test\\\"user@example.com\"");
}
}

View File

@@ -649,10 +649,6 @@ public class KotlinClientCodegenModelTest {
// base properties are present
TestUtils.assertFileContains(animalKt, "val id");
TestUtils.assertFileContains(animalKt, "val optionalProperty");
// base array with unique items = false is correctly handled as List
TestUtils.assertFileContains(animalKt, "val stringArray: kotlin.collections.List<kotlin.String>");
// base array with unique items = true is correctly handled as Set
TestUtils.assertFileContains(animalKt, "val stringSet: kotlin.collections.Set<kotlin.String>");
// base doesn't contain discriminator
TestUtils.assertFileNotContains(animalKt, "val discriminator");
@@ -662,10 +658,6 @@ public class KotlinClientCodegenModelTest {
// derived properties are overridden
TestUtils.assertFileContains(birdKt, "override val id");
TestUtils.assertFileContains(birdKt, "override val optionalProperty");
// derived array with unique items = false is correctly handled as List and with override
TestUtils.assertFileContains(birdKt, "override val stringArray: kotlin.collections.List<kotlin.String>");
// derived array with unique items = true is correctly handled as Set and with override
TestUtils.assertFileContains(birdKt, "override val stringSet: kotlin.collections.Set<kotlin.String>");
// derived doesn't contain disciminator
TestUtils.assertFileNotContains(birdKt, "val discriminator");
}

View File

@@ -89,8 +89,6 @@ public class KotlinSpringServerCodegenTest {
// base properties are present
TestUtils.assertFileContains(animalKt, "val id");
TestUtils.assertFileContains(animalKt, "val optionalProperty");
TestUtils.assertFileContains(animalKt, "val stringArray: kotlin.collections.List<kotlin.String>");
TestUtils.assertFileContains(animalKt, "val stringSet: kotlin.collections.Set<kotlin.String>");
// base doesn't contain discriminator
TestUtils.assertFileNotContains(animalKt, "val discriminator");
@@ -100,8 +98,6 @@ public class KotlinSpringServerCodegenTest {
// derived properties are overridden
TestUtils.assertFileContains(birdKt, "override val id");
TestUtils.assertFileContains(birdKt, "override val optionalProperty");
TestUtils.assertFileContains(birdKt, "override val stringArray: kotlin.collections.List<kotlin.String>");
TestUtils.assertFileContains(birdKt, "override val stringSet: kotlin.collections.Set<kotlin.String>");
// derived doesn't contain disciminator
TestUtils.assertFileNotContains(birdKt, "val discriminator");
}

View File

@@ -29,7 +29,6 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
@@ -147,33 +146,4 @@ public class PhpNextgenClientCodegenTest {
Assert.assertListNotContains(modelContent, a -> a.equals("$color = self::COLOR_UNKNOWN_DEFAULT_OPEN_API;"), "");
Assert.assertListContains(modelContent, a -> a.equalsIgnoreCase("\"Invalid value '%s' for 'color', must be one of '%s'\","), "");
}
@Test
public void testDifferentResponseSchemasWithEmpty() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/bugs/issue_22817.yaml", null, new ParseOptions())
.getOpenAPI();
codegen.setOutputDir(output.getAbsolutePath());
ClientOptInput input = new ClientOptInput()
.openAPI(openAPI)
.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
List<String> modelContent = Files
.readAllLines(files.get("DefaultApi.php").toPath())
.stream()
.map(String::trim)
.collect(Collectors.toList());
Assert.assertListContains(modelContent, a -> a.equals("): int|string|null"), "Expected to find nullable return type declaration.");
Assert.assertListNotContains(modelContent, a -> a.equals("): ?int|string"), "Expected to not find invalid union type with '?'.");
}
}

View File

@@ -51,7 +51,6 @@ import java.util.Map;
import static org.openapitools.codegen.TestUtils.createCodegenModelWrapper;
import static org.openapitools.codegen.languages.ProtobufSchemaCodegen.USE_SIMPLIFIED_ENUM_NAMES;
import static org.testng.Assert.assertEquals;
import static org.openapitools.codegen.languages.ProtobufSchemaCodegen.EXTRACT_ENUMS_TO_SEPARATE_FILES;
import static org.openapitools.codegen.languages.ProtobufSchemaCodegen.START_ENUMS_WITH_UNSPECIFIED;
public class ProtobufSchemaCodegenTest {
@@ -362,73 +361,6 @@ public class ProtobufSchemaCodegenTest {
Assert.assertEquals(enumVars1.get(1).get("isString"), false);
}
@Test(description = "Support multiple level of inheritance for discriminator - ensures properties from indirect children are included")
public void testCodeGenWithAllOfDiscriminatorMultipleLevels() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/allOf_composition_discriminator_multiple_inheritance.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Verify Animal proto file (discriminator parent)
TestUtils.ensureContainsFile(files, output, "models/animal.proto");
Path animalPath = Paths.get(output + "/models/animal.proto");
String animalContent = new String(Files.readAllBytes(animalPath), StandardCharsets.UTF_8);
// Properties from discriminated classes should be included in Animal:
// From Dog (direct child in discriminator mapping): bark
Assert.assertTrue(animalContent.contains("string bark"), "Animal should contain 'bark' property from Dog");
// From Feline (intermediate parent, NOT in discriminator mapping): name, furColor
Assert.assertTrue(animalContent.contains("string name"), "Animal should contain 'name' property from Feline");
Assert.assertTrue(animalContent.contains("string fur_color"), "Animal should contain 'fur_color' property from Feline");
// From Cat (indirect child through Feline, IN discriminator mapping): isIndoor, careDetails
Assert.assertTrue(animalContent.contains("bool is_indoor"), "Animal should contain 'is_indoor' property from Cat (indirect child)");
Assert.assertTrue(animalContent.contains("CareDetails care_details"), "Animal should contain 'care_details' property from Cat (indirect child)");
assertFileEquals(animalPath, Paths.get("src/test/resources/3_0/protobuf-schema/animal.proto"));
// Verify Cat proto file (indirect child in discriminator mapping)
TestUtils.ensureContainsFile(files, output, "models/cat.proto");
Path catPath = Paths.get(output + "/models/cat.proto");
String catContent = new String(Files.readAllBytes(catPath), StandardCharsets.UTF_8);
// Cat should import Animal (the discriminator parent), not Feline (its immediate allOf parent)
Assert.assertTrue(catContent.contains("import public \"models/animal.proto\";"),
"Cat should import Animal (discriminator parent)");
// Cat should also import CareDetails (its dependency)
Assert.assertTrue(catContent.contains("import public \"models/care_details.proto\";"),
"Cat should import CareDetails");
// Verify Feline proto file (intermediate parent, NOT in discriminator mapping)
TestUtils.ensureContainsFile(files, output, "models/feline.proto");
Path felinePath = Paths.get(output + "/models/feline.proto");
String felineContent = new String(Files.readAllBytes(felinePath), StandardCharsets.UTF_8);
// According to requirements: Feline inherits from Animal but is NOT in discriminator mapping
// So Feline should NOT import Animal
Assert.assertFalse(felineContent.contains("import public \"models/animal.proto\";"),
"Feline should NOT import Animal (not in discriminator mapping)");
// Verify Dog proto file (direct child in discriminator mapping)
TestUtils.ensureContainsFile(files, output, "models/dog.proto");
Path dogPath = Paths.get(output + "/models/dog.proto");
String dogContent = new String(Files.readAllBytes(dogPath), StandardCharsets.UTF_8);
// Dog should import Animal (the discriminator parent)
Assert.assertTrue(dogContent.contains("import public \"models/animal.proto\";"),
"Dog should import Animal (discriminator parent)");
output.deleteOnExit();
}
@SuppressWarnings("unchecked")
@Test(description = "Validate that enums in arrays are treated as complex types")
public void enumInArrayIsTreatedAsComplexType() {
@@ -474,591 +406,4 @@ public class ProtobufSchemaCodegenTest {
final CodegenProperty property = cm.vars.get(0);
Assert.assertEquals(property.baseName, "colorMap");
}
@Test(description = "Validate that a model referenced multiple times is imported only once in generated protobuf files")
public void testModelImportedOnlyOnce() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/model_imported_once.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that the main model file was generated
TestUtils.ensureContainsFile(files, output, "models/model.proto");
Path modelPath = Paths.get(output + "/models/model.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8);
// Count occurrences of the import statement for model A (using "public" keyword as generated)
String importStatement = "import public \"models/a.proto\";";
int importCount = countOccurrences(modelContent, importStatement);
// Assert that model A is imported exactly once despite being used in:
// - direct field in Model (directA)
// - field in SubModel which is nested in Model (SubModel.aReference)
Assert.assertEquals(importCount, 1, "Model A should be imported exactly once in model.proto");
// Check the SubModel file - it also references A directly
TestUtils.ensureContainsFile(files, output, "models/sub_model.proto");
Path subModelPath = Paths.get(output + "/models/sub_model.proto");
String subModelContent = new String(Files.readAllBytes(subModelPath), StandardCharsets.UTF_8);
int subModelImportCount = countOccurrences(subModelContent, importStatement);
Assert.assertEquals(subModelImportCount, 1, "Model A should be imported exactly once in sub_model.proto");
// Check the ExtensibleModel file
TestUtils.ensureContainsFile(files, output, "models/extensible_model.proto");
Path extensiblePath = Paths.get(output + "/models/extensible_model.proto");
String extensibleContent = new String(Files.readAllBytes(extensiblePath), StandardCharsets.UTF_8);
// Count occurrences in ExtensibleModel
int extensibleImportCount = countOccurrences(extensibleContent, importStatement);
// Assert that model A is imported exactly once in ExtensibleModel despite being used in:
// - direct field in ExtensibleModel (extensibleA)
// - field in ChildModel_1 (childA) which extends ExtensibleModel via discriminator
// - field in ChildModel_2 (directA) which also extends ExtensibleModel via discriminator
Assert.assertEquals(extensibleImportCount, 1, "Model A should be imported exactly once in extensible_model.proto");
output.deleteOnExit();
}
private int countOccurrences(String content, String substring) {
int count = 0;
int index = 0;
while ((index = content.indexOf(substring, index)) != -1) {
count++;
index += substring.length();
}
return count;
}
@Test(description = "Validate that enums are extracted to separate files when extractEnumsToSeparateFiles option is enabled")
public void testExtractEnumsToSeparateFiles() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"))
.addAdditionalProperty(EXTRACT_ENUMS_TO_SEPARATE_FILES, true);
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that separate enum files were generated
// With the new naming scheme, inline enum names include the parent model prefix
TestUtils.ensureContainsFile(files, output, "models/separated_enum.proto");
TestUtils.ensureContainsFile(files, output, "models/model_with_enums_inline_enum_property.proto");
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums_another_inline_enum_property.proto");
// Check that the model file was generated
TestUtils.ensureContainsFile(files, output, "models/model_with_enums.proto");
Path modelPath = Paths.get(output + "/models/model_with_enums.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8);
// Verify that enums are NOT defined inline in the model
Assert.assertFalse(modelContent.contains("enum Inline_enum_property"),
"Inline enum should be extracted to separate file");
// Verify that the model imports the separated enum files
Assert.assertTrue(modelContent.contains("import public \"models/separated_enum.proto\";"),
"Model should import the separated enum file");
Assert.assertTrue(modelContent.contains("import public \"models/model_with_enums_inline_enum_property.proto\";"),
"Model should import the inline enum file with parent model prefix");
// Verify that the model uses the correct enum reference with .Enum suffix
// With the new naming scheme, inline enums use ParentModelName_FieldName format
Assert.assertTrue(modelContent.contains("ModelWithEnums_InlineEnumProperty.Enum"),
"Model should reference extracted enum with .Enum suffix and parent model prefix");
// Check the AllOfModel file
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums.proto");
Path allOfModelPath = Paths.get(output + "/models/all_of_model_with_enums.proto");
String allOfModelContent = new String(Files.readAllBytes(allOfModelPath), StandardCharsets.UTF_8);
// Verify that the allOf model imports the separated enum files
Assert.assertTrue(allOfModelContent.contains("import public \"models/all_of_model_with_enums_another_inline_enum_property.proto\";"),
"AllOf model should import its inline enum file with parent model prefix");
// Verify the separated enum file content
Path separatedEnumPath = Paths.get(output + "/models/separated_enum.proto");
String separatedEnumContent = new String(Files.readAllBytes(separatedEnumPath), StandardCharsets.UTF_8);
Assert.assertTrue(separatedEnumContent.contains("package openapitools;"),
"Separated enum file should contain a valid package declaration");
Assert.assertTrue(separatedEnumContent.contains("message SeparatedEnum"),
"Separated enum file should contain the message wrapper");
Assert.assertTrue(separatedEnumContent.contains("enum Enum {"),
"Separated enum file should contain inner Enum definition");
Assert.assertTrue(separatedEnumContent.contains("SEPARATED_ENUM_VALUE1"),
"Separated enum should contain SEPARATED_ENUM_VALUE1");
Assert.assertTrue(separatedEnumContent.contains("SEPARATED_ENUM_VALUE2"),
"Separated enum should contain SEPARATED_ENUM_VALUE2");
// Verify the inline enum file content - uses parent model name prefix
Path inlineEnumPath = Paths.get(output + "/models/model_with_enums_inline_enum_property.proto");
String inlineEnumContent = new String(Files.readAllBytes(inlineEnumPath), StandardCharsets.UTF_8);
Assert.assertTrue(inlineEnumContent.contains("package openapitools;"),
"Inline enum file should contain a valid package declaration");
Assert.assertTrue(inlineEnumContent.contains("message ModelWithEnums_InlineEnumProperty"),
"Inline enum file should contain the message wrapper with parent model prefix");
Assert.assertTrue(inlineEnumContent.contains("enum Enum {"),
"Inline enum file should contain inner Enum definition");
// Note: Enum values keep the prefixes from the original field name, not parent+field
// since they are already scoped within the message wrapper
Assert.assertTrue(inlineEnumContent.contains("INLINE_ENUM_PROPERTY_VALUE2"),
"Inline enum should contain enum value");
Assert.assertTrue(inlineEnumContent.contains("INLINE_ENUM_PROPERTY_VALUE3"),
"Inline enum should contain enum value");
Assert.assertTrue(inlineEnumContent.contains("INLINE_ENUM_PROPERTY_VALUE4"),
"Inline enum should contain enum value");
output.deleteOnExit();
}
@Test(description = "Validate that enums are extracted to separate files when extractEnumsToSeparateFiles option is enabled")
public void testExtractEnumsToSeparateFilesWithOtherEnumOptions() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"))
.addAdditionalProperty("removeEnumValuePrefix", false)
.addAdditionalProperty(START_ENUMS_WITH_UNSPECIFIED, true)
.addAdditionalProperty(USE_SIMPLIFIED_ENUM_NAMES, true)
.addAdditionalProperty(EXTRACT_ENUMS_TO_SEPARATE_FILES, true);
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that separate enum files were generated with parent model prefix
TestUtils.ensureContainsFile(files, output, "models/separated_enum.proto");
TestUtils.ensureContainsFile(files, output, "models/model_with_enums_inline_enum_property.proto");
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums_another_inline_enum_property.proto");
// Check that the model file was generated
TestUtils.ensureContainsFile(files, output, "models/model_with_enums.proto");
Path modelPath = Paths.get(output + "/models/model_with_enums.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8);
// Verify that enums are NOT defined inline in the model
Assert.assertFalse(modelContent.contains("enum Inline_enum_property"),
"Inline enum should be extracted to separate file");
// Verify that the model imports the separated enum files
Assert.assertTrue(modelContent.contains("import public \"models/separated_enum.proto\";"),
"Model should import the separated enum file");
Assert.assertTrue(modelContent.contains("import public \"models/model_with_enums_inline_enum_property.proto\";"),
"Model should import the inline enum file with parent model prefix");
// Verify that the model uses the correct enum reference with .Enum suffix
// With the new naming scheme, inline enums use ParentModelName_FieldName format
Assert.assertTrue(modelContent.contains("ModelWithEnums_InlineEnumProperty.Enum"),
"Model should reference extracted enum with .Enum suffix and parent model prefix");
// Check the AllOfModel file
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums.proto");
Path allOfModelPath = Paths.get(output + "/models/all_of_model_with_enums.proto");
String allOfModelContent = new String(Files.readAllBytes(allOfModelPath), StandardCharsets.UTF_8);
// Verify that the allOf model imports the separated enum files
Assert.assertTrue(allOfModelContent.contains("import public \"models/all_of_model_with_enums_another_inline_enum_property.proto\";"),
"AllOf model should import its inline enum file with parent model prefix");
// Verify the separated enum file content
Path separatedEnumPath = Paths.get(output + "/models/separated_enum.proto");
String separatedEnumContent = new String(Files.readAllBytes(separatedEnumPath), StandardCharsets.UTF_8);
Assert.assertTrue(separatedEnumContent.contains("package openapitools;"),
"Separated enum file should contain a valid package declaration");
Assert.assertTrue(separatedEnumContent.contains("message SeparatedEnum"),
"Separated enum file should contain the message wrapper");
Assert.assertTrue(separatedEnumContent.contains("enum Enum {"),
"Separated enum file should contain inner Enum definition");
Assert.assertTrue(separatedEnumContent.contains("UNSPECIFIED"),
"Separated enum should contain UNSPECIFIED");
Assert.assertTrue(separatedEnumContent.contains("VALUE1"),
"Separated enum should contain VALUE1");
Assert.assertTrue(separatedEnumContent.contains("VALUE2"),
"Separated enum should contain VALUE2");
// Verify the inline enum file content - uses parent model name prefix
Path inlineEnumPath = Paths.get(output + "/models/model_with_enums_inline_enum_property.proto");
String inlineEnumContent = new String(Files.readAllBytes(inlineEnumPath), StandardCharsets.UTF_8);
Assert.assertTrue(inlineEnumContent.contains("package openapitools;"),
"Inline enum file should contain a valid package declaration");
Assert.assertTrue(inlineEnumContent.contains("message ModelWithEnums_InlineEnumProperty"),
"Inline enum file should contain the message wrapper with parent model prefix");
Assert.assertTrue(inlineEnumContent.contains("enum Enum {"),
"Inline enum file should contain inner Enum definition");
Assert.assertTrue(inlineEnumContent.contains("UNSPECIFIED"),
"Inline enum should contain UNSPECIFIED");
// With simplified names, enum values don't have prefixes, just the base values
Assert.assertTrue(inlineEnumContent.contains("VALUE2"),
"Inline enum should contain enum value");
Assert.assertTrue(inlineEnumContent.contains("VALUE3"),
"Inline enum should contain enum value");
Assert.assertTrue(inlineEnumContent.contains("VALUE4"),
"Inline enum should contain enum value");
//output.deleteOnExit();
}
@Test(description = "Test toModelImport with various input formats")
public void testToModelImportVariations() {
final ProtobufSchemaCodegen codegen = new ProtobufSchemaCodegen();
codegen.setModelPackage("models");
// Normal case
Assert.assertEquals(codegen.toModelImport("Pet"), "models/pet");
// Already prefixed - should not duplicate
Assert.assertEquals(codegen.toModelImport("models/pet"), "models/pet");
// With different casing
Assert.assertEquals(codegen.toModelImport("PetStore"), "models/pet_store");
// With numbers
Assert.assertEquals(codegen.toModelImport("Pet123"), "models/pet123");
// Empty model package
codegen.setModelPackage("");
Assert.assertEquals(codegen.toModelImport("Pet"), "Pet");
}
@Test(description = "Validate that enum imports are added to discriminator parent when extractEnumsToSeparateFiles is enabled")
public void testDiscriminatorWithExtractedEnums() throws IOException {
// set line break to \n across all platforms
String originalLineSeparator = System.getProperty("line.separator");
try {
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"))
.addAdditionalProperty(EXTRACT_ENUMS_TO_SEPARATE_FILES, true);
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that the discriminator parent file was generated
TestUtils.ensureContainsFile(files, output, "models/discriminated_model.proto");
Path discriminatorPath = Paths.get(output + "/models/discriminated_model.proto");
String discriminatorContent = new String(Files.readAllBytes(discriminatorPath), StandardCharsets.UTF_8);
// The discriminator parent should have properties from both children
// From ModelTypeAWithInlineEnum: specificPropertyA, inlineEnumPropertyA
Assert.assertTrue(discriminatorContent.contains("string specific_property_a"),
"Discriminator parent should contain 'specific_property_a' from child A");
// The enum property should be present with the correct .Enum suffix
// With the new naming scheme, inline enums use ParentModelName_FieldName format
Assert.assertTrue(discriminatorContent.contains("ModelTypeAWithInlineEnum_InlineEnumProperty.Enum inline_enum_property"),
"Discriminator parent should contain extracted enum property from child A with .Enum suffix and parent model prefix");
// CRITICAL: The discriminator parent should import the extracted enum file
Assert.assertTrue(discriminatorContent.contains("import public \"models/model_type_a_with_inline_enum_inline_enum_property.proto\";"),
"Discriminator parent MUST import the extracted enum from child A with parent model prefix");
// From ModelTypeBWithInlineEnum: specificPropertyB, referenceEnumPropertyB
Assert.assertTrue(discriminatorContent.contains("string specific_property_b"),
"Discriminator parent should contain 'specific_property_b' from child B");
// Child B references SeparatedEnum (not inline), so it should be imported
Assert.assertTrue(discriminatorContent.contains("import public \"models/separated_enum.proto\";"),
"Discriminator parent should import the separated enum referenced by child B");
// Verify the extracted enum file for inline enum from child A was created
// The file name uses snake_case of the full wrapper message name
TestUtils.ensureContainsFile(files, output, "models/model_type_a_with_inline_enum_inline_enum_property.proto");
Path enumPath = Paths.get(output + "/models/model_type_a_with_inline_enum_inline_enum_property.proto");
String enumContent = new String(Files.readAllBytes(enumPath), StandardCharsets.UTF_8);
Assert.assertTrue(enumContent.contains("message ModelTypeAWithInlineEnum_InlineEnumProperty"),
"Extracted enum file should contain the message wrapper with parent model prefix");
Assert.assertTrue(enumContent.contains("enum Enum {"),
"Extracted enum file should contain inner Enum definition");
// Note: Enum values keep the prefixes from the original field name, not parent+field
// since they are already scoped within the message wrapper
Assert.assertTrue(enumContent.contains("INLINE_ENUM_PROPERTY_VALUE7"),
"Extracted enum should contain enum value");
Assert.assertTrue(enumContent.contains("INLINE_ENUM_PROPERTY_VALUE8"),
"Extracted enum should contain enum value");
output.deleteOnExit();
} finally {
// Restore original property to avoid side effects on other tests
System.setProperty("line.separator", originalLineSeparator);
}
}
@SuppressWarnings("unchecked")
@Test(description = "Validate that referenced enum models are correctly wrapped with .Enum suffix when extractEnumsToSeparateFiles is enabled")
public void testReferencedEnumsWithExtraction() throws IOException {
// set line break to \n across all platforms
String originalLineSeparator = System.getProperty("line.separator");
try {
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"))
.addAdditionalProperty(EXTRACT_ENUMS_TO_SEPARATE_FILES, true);
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that the model file was generated
TestUtils.ensureContainsFile(files, output, "models/model_with_enums.proto");
Path modelPath = Paths.get(output + "/models/model_with_enums.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8)
.replace("\r\n", "\n").replace("\r", "\n");
// CRITICAL: The model should have the inline enum property with .Enum suffix
// With the new naming scheme, inline enums use ParentModelName_FieldName format
Assert.assertTrue(modelContent.contains("ModelWithEnums_InlineEnumProperty.Enum inline_enum_property"),
"Model should reference inline extracted enum with .Enum suffix and parent model prefix");
// CRITICAL: The model should have the referenced enum property with .Enum suffix
// This is the bug being fixed - referenced enums should also get wrapped
Assert.assertTrue(modelContent.contains("SeparatedEnum.Enum reference_enum_property"),
"Model should reference referenced enum with .Enum suffix (THIS IS THE FIX)");
// Verify that both enum files are imported
Assert.assertTrue(modelContent.contains("import public \"models/separated_enum.proto\";"),
"Model should import the separated enum file");
Assert.assertTrue(modelContent.contains("import public \"models/model_with_enums_inline_enum_property.proto\";"),
"Model should import the inline enum file with parent model prefix");
// Verify the separated enum file was correctly generated
TestUtils.ensureContainsFile(files, output, "models/separated_enum.proto");
Path separatedEnumPath = Paths.get(output + "/models/separated_enum.proto");
String separatedEnumContent = new String(Files.readAllBytes(separatedEnumPath), StandardCharsets.UTF_8);
Assert.assertTrue(separatedEnumContent.contains("message SeparatedEnum"),
"Separated enum file should contain the message wrapper");
Assert.assertTrue(separatedEnumContent.contains("enum Enum {"),
"Separated enum file should contain inner Enum definition");
// Verify the inline enum file was correctly generated with parent model prefix
TestUtils.ensureContainsFile(files, output, "models/model_with_enums_inline_enum_property.proto");
Path inlineEnumPath = Paths.get(output + "/models/model_with_enums_inline_enum_property.proto");
String inlineEnumContent = new String(Files.readAllBytes(inlineEnumPath), StandardCharsets.UTF_8);
Assert.assertTrue(inlineEnumContent.contains("message ModelWithEnums_InlineEnumProperty"),
"Inline enum file should contain the message wrapper with parent model prefix");
Assert.assertTrue(inlineEnumContent.contains("enum Enum {"),
"Inline enum file should contain inner Enum definition");
output.deleteOnExit();
} finally {
// Restore original property to avoid side effects on other tests
System.setProperty("line.separator", originalLineSeparator);
}
}
@SuppressWarnings("unchecked")
@Test(description = "Validate backward compatibility: extracted_enum.yaml generates inline enums when EXTRACT_ENUMS_TO_SEPARATE_FILES is NOT enabled")
public void testEnumsRemainsInlineWithoutExtraction() throws IOException {
// set line break to \n across all platforms
String originalLineSeparator = System.getProperty("line.separator");
try {
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that the model file was generated
TestUtils.ensureContainsFile(files, output, "models/model_with_enums.proto");
Path modelPath = Paths.get(output + "/models/model_with_enums.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8)
.replace("\r\n", "\n").replace("\r", "\n");
// WITHOUT extraction: Enums should be defined INLINE in the model file
// Check for inline enum definitions (not extracted to separate files)
// The inline enum should contain the enum values (not a message wrapper)
Assert.assertTrue(modelContent.contains("enum") && modelContent.contains("VALUE2"),
"Without extraction, inline enums should be defined inline in the model");
// Verify that inline enums use simple type references (NOT wrapped with .Enum)
// When enums are inline, they're referenced as the enum name directly
// (not as ParentModel_FieldName.Enum which is only used for extracted enums)
Assert.assertTrue(!modelContent.contains(".Enum"),
"Without extraction, enum properties should NOT reference .Enum suffix");
// Without extraction: Inline enum files should NOT be generated
// (Note: SeparatedEnum.proto WILL be generated because SeparatedEnum is a top-level schema,
// but inline_enum_property.proto should NOT be generated because it's an inline enum)
List<Path> inlineEnumFiles = new java.util.ArrayList<>();
if (Files.exists(Paths.get(output + "/models/inline_enum_property.proto"))) {
inlineEnumFiles.add(Paths.get(output + "/models/inline_enum_property.proto"));
}
if (Files.exists(Paths.get(output + "/models/another_inline_enum_property.proto"))) {
inlineEnumFiles.add(Paths.get(output + "/models/another_inline_enum_property.proto"));
}
Assert.assertTrue(inlineEnumFiles.isEmpty(),
"Without extraction option enabled, inline enum files should NOT be created as separate files");
// Verify that imports for inline enum files are NOT present
Assert.assertFalse(modelContent.contains("import public \"models/inline_enum_property.proto\""),
"Without extraction, there should be no inline enum file imports");
Assert.assertFalse(modelContent.contains("import public \"models/another_inline_enum_property.proto\""),
"Without extraction, there should be no inline enum file imports");
// Check the AllOfModel file
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums.proto");
Path allOfModelPath = Paths.get(output + "/models/all_of_model_with_enums.proto");
String allOfModelContent = new String(Files.readAllBytes(allOfModelPath), StandardCharsets.UTF_8);
// IMPORTANT: AllOf composition in protobuf has different semantics than OpenAPI allOf.
// In protobuf, allOf models only contain direct properties of the model, not inherited/composed properties.
// This differs from OpenAPI where allOf models would include properties from all composed schemas.
// Therefore, we validate backward compatibility by ensuring:
// 1. The model file is generated (proving structure is correct)
// 2. No .Enum suffix is used (proving extraction mode is OFF - not using extracted enum references)
// 3. Inline enums are defined inline (proving backward compatibility works with inline enums)
Assert.assertTrue(!allOfModelContent.isEmpty(),
"Without extraction option, the allOf model file should be generated");
Assert.assertFalse(allOfModelContent.contains(".Enum"),
"Without extraction option, enums should NOT use .Enum suffix (should be inline)");
Assert.assertTrue(allOfModelContent.contains("enum") && allOfModelContent.contains("VALUE"),
"Without extraction option, model should contain inline enum definitions");
output.deleteOnExit();
} finally {
// Restore original property to avoid side effects on other tests
System.setProperty("line.separator", originalLineSeparator);
}
}
@Test(description = "Validate that enums in arrays are correctly handled with .Enum suffix when extractEnumsToSeparateFiles is enabled")
public void testEnumsInArraysWithExtraction() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
System.out.println("EnumsInArrays Temporary output directory: " + output.getAbsolutePath());
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"))
.addAdditionalProperty("removeEnumValuePrefix", false)
.addAdditionalProperty(START_ENUMS_WITH_UNSPECIFIED, true)
.addAdditionalProperty(USE_SIMPLIFIED_ENUM_NAMES, true)
.addAdditionalProperty(EXTRACT_ENUMS_TO_SEPARATE_FILES, true);
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that the model file was generated
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums.proto");
Path modelPath = Paths.get(output + "/models/all_of_model_with_enums.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8)
.replace("\r\n", "\n").replace("\r", "\n");
// Test Case 1: Array with REFERENCED enum (listOfReferencedEnums)
// Should have .Enum suffix: repeated SeparatedEnum.Enum
// Use regex to validate structure without depending on specific field numbers
java.util.regex.Pattern referencedEnumPattern = java.util.regex.Pattern.compile(
"repeated\\s+SeparatedEnum\\.Enum\\s+list_of_referenced_enums\\s*=\\s*\\d+");
Assert.assertTrue(
referencedEnumPattern.matcher(modelContent).find(),
"Array with referenced enum should use .Enum suffix with pattern: repeated SeparatedEnum.Enum list_of_referenced_enums = <number>");
// Test Case 2: Array with INLINE enum (listOfEnums) - in AllOfModelWithEnums
// Should have .Enum suffix: repeated AllOfModelWithEnums_ListOfEnums.Enum
// Use regex to validate structure without depending on specific field numbers
java.util.regex.Pattern inlineEnumPattern = java.util.regex.Pattern.compile(
"repeated\\s+AllOfModelWithEnums_ListOfEnums\\.Enum\\s+list_of_enums\\s*=\\s*\\d+");
Assert.assertTrue(
inlineEnumPattern.matcher(modelContent).find(),
"Array with inline enum should use .Enum suffix with pattern: repeated AllOfModelWithEnums_ListOfEnums.Enum list_of_enums = <number>");
// Verify the imported enum file for referenced enum exists
TestUtils.ensureContainsFile(files, output, "models/separated_enum.proto");
// Verify the extracted inline enum file for arrays exists
TestUtils.ensureContainsFile(files, output, "models/all_of_model_with_enums_list_of_enums.proto");
Path listOfEnumsPath = Paths.get(output + "/models/all_of_model_with_enums_list_of_enums.proto");
String listOfEnumsContent = new String(Files.readAllBytes(listOfEnumsPath), StandardCharsets.UTF_8)
.replace("\r\n", "\n").replace("\r", "\n");
// Verify the wrapper message structure
Assert.assertTrue(listOfEnumsContent.contains("message AllOfModelWithEnums_ListOfEnums"),
"Extracted inline enum file should contain wrapper message");
Assert.assertTrue(listOfEnumsContent.contains("enum Enum"),
"Wrapper message should contain inner Enum");
Assert.assertTrue(listOfEnumsContent.contains("VALUE10") && listOfEnumsContent.contains("VALUE11"),
"Wrapper message should contain enum values");
output.deleteOnExit();
}
@Test(description = "Validate that enums in arrays remain inline when extractEnumsToSeparateFiles is NOT enabled")
public void testEnumsInArraysWithoutExtraction() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("protobuf-schema")
.setInputSpec("src/test/resources/3_0/protobuf-schema/extracted_enum.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
// Note: EXTRACT_ENUMS_TO_SEPARATE_FILES is NOT enabled
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Check that the model file was generated
TestUtils.ensureContainsFile(files, output, "models/model_with_enums.proto");
Path modelPath = Paths.get(output + "/models/model_with_enums.proto");
String modelContent = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8)
.replace("\r\n", "\n").replace("\r", "\n");
// Without extraction: Arrays of enums should NOT use .Enum suffix
// Instead, they should use the type directly or inline definition
Assert.assertFalse(modelContent.contains(".Enum"),
"Without extraction, enums should NOT use .Enum suffix");
// Extracted inline enum files should NOT exist
Assert.assertFalse(Files.exists(Paths.get(output + "/models/model_with_enums_list_of_enums.proto")),
"Without extraction, inline enum array files should NOT be generated");
output.deleteOnExit();
}
}

View File

@@ -48,8 +48,6 @@ components:
properties:
name:
type: string
characteristics:
$ref: '#/components/schemas/Characteristics'
Reptile:
allOf:
- $ref: '#/components/schemas/Pet'
@@ -80,7 +78,7 @@ components:
- $ref: '#/components/schemas/Lizard'
discriminator:
propertyName: petType
# per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminator-object
# per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject
# this discriminator must be included to use it as a hint to pick a schema
MyPetsNoDisc:
oneOf:
@@ -103,8 +101,3 @@ components:
C:
allOf:
- $ref: '#/components/schemas/B'
Characteristics:
type: object
properties:
canHunt:
type: boolean

View File

@@ -1,58 +0,0 @@
openapi: 3.0.3
info:
title: OAI Specification example for Polymorphism
version: 1.0.0
paths:
/status:
get:
responses:
'201':
description: desc
components:
schemas:
Animal:
type: object
required:
- petType
properties:
petType:
type: string
discriminator:
propertyName: petType
mapping:
dog: '#/components/schemas/Dog'
cat: '#/components/schemas/Cat'
Feline:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
name:
type: string
furColor:
type: string
Cat:
allOf:
- $ref: '#/components/schemas/Feline'
- type: object
properties:
isIndoor:
type: boolean
careDetails:
$ref: '#/components/schemas/CareDetails'
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
bark:
type: string
CareDetails:
type: object
properties:
veterinarian:
type: string
lastVetVisit:
type: string
format: date

View File

@@ -104,17 +104,4 @@ components:
hunts:
type: boolean
required:
- pet_type
OneOfPrimitiveTypes:
type: object
properties:
value:
oneOf:
- type: boolean
- type: integer
format: int64
- $ref: "#/components/schemas/PetByAge"
- type: array
items:
$ref: "#/components/schemas/PetByAge"
- pet_type

View File

@@ -1,52 +0,0 @@
openapi: 3.0.0
info:
title: Test Escaping in Examples
version: 1.0.0
paths:
/test:
get:
operationId: testEscaping
tags:
- test
parameters:
- name: stringWithQuotes
in: query
required: true
schema:
type: string
example: 'John "Johnny" Doe'
- name: stringWithBackslash
in: query
required: true
schema:
type: string
example: 'C:\path\to\file'
- name: emailWithQuotes
in: query
required: true
schema:
type: string
format: email
example: 'test"user@example.com'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/TestResponse'
components:
schemas:
TestResponse:
type: object
properties:
name:
type: string
example: 'Name with "quotes" inside'
path:
type: string
example: 'C:\Windows\System32'
email:
type: string
format: email
example: 'user"name@example.com'

View File

@@ -41,19 +41,8 @@ components:
format: uuid
optional_property:
type: number
stringSet:
type: array
items:
type: string
uniqueItems: true
stringArray:
type: array
items:
type: string
required:
- id
- string_set
- string_array
discriminator:
propertyName: discriminator
mapping:

View File

@@ -1,31 +0,0 @@
/*
OAI Specification example for Polymorphism
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator: https://openapi-generator.tech
*/
syntax = "proto3";
package openapitools;
import public "models/care_details.proto";
message Animal {
string pet_type = 482112090;
string name = 3373707;
string fur_color = 478695002;
bool is_indoor = 183319801;
CareDetails care_details = 176721135;
string bark = 3016376;
}

View File

@@ -1,77 +0,0 @@
openapi: 3.0.0
info:
title: Enum extraction test
version: '2.0'
paths: {}
components:
schemas:
SeparatedEnum:
type: string
enum:
- VALUE1
- VALUE2
ModelWithEnums:
type: object
properties:
referenceEnumProperty:
$ref: "#/components/schemas/SeparatedEnum"
inlineEnumProperty:
type: string
enum:
- VALUE2
- VALUE3
- VALUE4
listOfEnums:
type: array
items:
type: string
enum:
- VALUE10
- VALUE11
AllOfModelWithEnums:
allOf:
- $ref: "#/components/schemas/ModelWithEnums"
- type: object
properties:
anotherInlineEnumProperty:
type: string
enum:
- VALUE5
- VALUE6
listOfReferencedEnums:
type: array
items:
$ref: '#/components/schemas/SeparatedEnum'
DiscriminatedModel:
type: object
properties:
commonProperty:
type: string
modelType:
type: string
discriminator:
propertyName: modelType
mapping:
typeA: "#/components/schemas/ModelTypeAWithInlineEnum"
typeB: "#/components/schemas/ModelTypeBWithInlineEnum"
ModelTypeAWithInlineEnum:
allOf:
- $ref: "#/components/schemas/DiscriminatedModel"
- type: object
properties:
specificPropertyA:
type: string
inlineEnumProperty:
type: string
enum:
- VALUE7
- VALUE8
ModelTypeBWithInlineEnum:
allOf:
- $ref: "#/components/schemas/DiscriminatedModel"
- type: object
properties:
specificPropertyB:
type: string
referenceEnumPropertyB:
$ref: "#/components/schemas/SeparatedEnum"

View File

@@ -1,89 +0,0 @@
openapi: 3.0.0
info:
title: Model Import Test
version: 1.0.0
paths: {}
components:
schemas:
A:
type: object
description: Base model A that will be referenced multiple times
properties:
id:
type: string
value:
type: string
required:
- id
SubModel:
type: object
description: SubModel that uses model A
allOf:
- $ref: '#/components/schemas/ExtensibleModel'
- type: object
properties:
subField:
type: string
aReference:
$ref: '#/components/schemas/A'
required:
- subField
Model:
type: object
description: Main model that uses A directly and via SubModel
properties:
name:
type: string
directA:
$ref: '#/components/schemas/A'
nestedSubModel:
$ref: '#/components/schemas/SubModel'
required:
- name
ExtensibleModel:
type: object
description: Extensible model with discriminator that uses model A
discriminator:
propertyName: type
mapping:
child1: '#/components/schemas/ChildModel_1'
child2: '#/components/schemas/ChildModel_2'
properties:
type:
type: string
extensibleA:
$ref: '#/components/schemas/A'
required:
- type
ChildModel_1:
allOf:
- $ref: '#/components/schemas/ExtensibleModel'
- type: object
properties:
childSpecificField:
type: string
childA:
$ref: '#/components/schemas/A'
ChildModel_2:
allOf:
- $ref: '#/components/schemas/SubExtensibleModel'
- type: object
properties:
anotherChildSpecificField:
type: integer
directA:
$ref: '#/components/schemas/A'
SubExtensibleModel:
allOf:
- $ref: '#/components/schemas/ExtensibleModel'
- type: object
properties:
aSubExtensibleField:
type: boolean
subDirectA:
$ref: '#/components/schemas/A'

View File

@@ -12,20 +12,14 @@ syntax = "proto3";
package openapitools;
import public "models/characteristics.proto";
message Pet {
string pet_type = 482112090;
string name = 3373707;
Characteristics characteristics = 455429578;
string bark = 3016376;
bool loves_rocks = 465093427;
bool has_legs = 140596906;
}

View File

@@ -93,16 +93,4 @@ components:
- "optionTwo"
type: string
required:
- discriminatorField
OneOfPrimitiveTypes:
type: object
properties:
value:
oneOf:
- type: boolean
- type: integer
format: int64
- $ref: "#/components/schemas/TestA"
- type: array
items:
$ref: "#/components/schemas/TestA"
- discriminatorField

View File

@@ -1,24 +0,0 @@
openapi: 3.0.4
info:
title: "Different response schemas including an empty one"
version: "1.0.0"
paths:
/example:
get:
operationId: exampleGet
responses:
200:
description: "A successful response with data"
content:
application/json:
schema:
type: integer
400:
description: "A bad request with a message"
content:
application/json:
schema:
type: string
500:
description: "An internal server error with no content"
content: { }

View File

@@ -260,7 +260,7 @@
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<threetenbp-version>2.9.10</threetenbp-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<assertj-version>3.27.7</assertj-version>
<assertj-version>3.23.1</assertj-version>
<junit-version>5.10.2</junit-version>
</properties>
</project>

View File

@@ -701,7 +701,9 @@ public class ApiClient extends JavaTimeFormatter {
break;
} catch (HttpServerErrorException | HttpClientErrorException ex) {
if (ex instanceof HttpServerErrorException
|| ex.getStatusCode().equals(HttpStatus.TOO_MANY_REQUESTS)) {
|| ((HttpClientErrorException) ex)
.getStatusCode()
.equals(HttpStatus.TOO_MANY_REQUESTS)) {
attempts++;
if (attempts < maxAttemptsForRetry) {
try {

View File

@@ -57,7 +57,7 @@ enum class ApiStringEnumRef(val value: kotlin.String) {
*/
fun decode(data: kotlin.Any?): ApiStringEnumRef? = data?.let {
val normalizedData = "$it".lowercase()
entries.firstOrNull { value ->
values().firstOrNull { value ->
it == value || normalizedData == "$value".lowercase()
}
}

View File

@@ -67,7 +67,7 @@ enum class StringEnumRef(@get:JsonValue val value: kotlin.String) {
throw IllegalArgumentException("Value for StringEnumRef cannot be null")
}
val normalizedData = "$data".lowercase()
return entries.firstOrNull { value ->
return values().firstOrNull { value ->
data == value || normalizedData == "$value".lowercase()
}
?: unknown_default_open_api

View File

@@ -67,7 +67,7 @@ enum class StringEnumRef(@get:JsonValue val value: kotlin.String) {
throw IllegalArgumentException("Value for StringEnumRef cannot be null")
}
val normalizedData = "$data".lowercase()
return entries.firstOrNull { value ->
return values().firstOrNull { value ->
data == value || normalizedData == "$value".lowercase()
}
?: unknown_default_open_api

View File

@@ -55,7 +55,7 @@ enum class ApiStringEnumRef(val value: kotlin.String) {
*/
fun decode(data: kotlin.Any?): ApiStringEnumRef? = data?.let {
val normalizedData = "$it".lowercase()
entries.firstOrNull { value ->
values().firstOrNull { value ->
it == value || normalizedData == "$value".lowercase()
}
}

View File

@@ -119,7 +119,7 @@ DefaultValue <- R6::R6Class(
DefaultValueObject <- list()
if (!is.null(self$`array_string_enum_ref_default`)) {
DefaultValueObject[["array_string_enum_ref_default"]] <-
self$extractSimpleType(self$`array_string_enum_ref_default`)
lapply(self$`array_string_enum_ref_default`, function(x) x$toSimpleType())
}
if (!is.null(self$`array_string_enum_default`)) {
DefaultValueObject[["array_string_enum_default"]] <-
@@ -152,29 +152,6 @@ DefaultValue <- R6::R6Class(
return(DefaultValueObject)
},
extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},
hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},
#' @description
#' Deserialize JSON string into an instance of DefaultValue
#'

View File

@@ -115,7 +115,7 @@ Pet <- R6::R6Class(
}
if (!is.null(self$`category`)) {
PetObject[["category"]] <-
self$extractSimpleType(self$`category`)
self$`category`$toSimpleType()
}
if (!is.null(self$`photoUrls`)) {
PetObject[["photoUrls"]] <-
@@ -123,7 +123,7 @@ Pet <- R6::R6Class(
}
if (!is.null(self$`tags`)) {
PetObject[["tags"]] <-
self$extractSimpleType(self$`tags`)
lapply(self$`tags`, function(x) x$toSimpleType())
}
if (!is.null(self$`status`)) {
PetObject[["status"]] <-
@@ -132,29 +132,6 @@ Pet <- R6::R6Class(
return(PetObject)
},
extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},
hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},
#' @description
#' Deserialize JSON string into an instance of Pet
#'

View File

@@ -162,7 +162,6 @@ export class RequestContext {
export interface ResponseBody {
text(): Promise<string>;
binary(): Promise<Buffer>;
stream(): ReadableStream<Uint8Array> | null;
}
/**
@@ -179,10 +178,6 @@ export class SelfDecodingBody implements ResponseBody {
const data: Buffer = await this.dataSource;
return data.toString();
}
stream(): ReadableStream<Uint8Array> | null {
return null;
}
}
export class ResponseContext {

View File

@@ -22,8 +22,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
const body = {
text: () => resp.text(),
binary: () => resp.buffer(),
stream: () => resp.body
binary: () => resp.buffer()
};
return new ResponseContext(resp.status, headers, body);
});

View File

@@ -644,7 +644,9 @@ public class ApiClient extends JavaTimeFormatter {
break;
} catch (HttpServerErrorException | HttpClientErrorException ex) {
if (ex instanceof HttpServerErrorException
|| ex.getStatusCode().equals(HttpStatus.TOO_MANY_REQUESTS)) {
|| ((HttpClientErrorException) ex)
.getStatusCode()
.equals(HttpStatus.TOO_MANY_REQUESTS)) {
attempts++;
if (attempts < maxAttemptsForRetry) {
try {

View File

@@ -644,7 +644,9 @@ public class ApiClient extends JavaTimeFormatter {
break;
} catch (HttpServerErrorException | HttpClientErrorException ex) {
if (ex instanceof HttpServerErrorException
|| ex.getStatusCode().equals(HttpStatus.TOO_MANY_REQUESTS)) {
|| ((HttpClientErrorException) ex)
.getStatusCode()
.equals(HttpStatus.TOO_MANY_REQUESTS)) {
attempts++;
if (attempts < maxAttemptsForRetry) {
try {

View File

@@ -54,7 +54,7 @@ enum class Code(val value: kotlin.Int) {
*/
fun decode(data: kotlin.Any?): Code? = data?.let {
val normalizedData = "$it".lowercase()
entries.firstOrNull { value ->
values().firstOrNull { value ->
it == value || normalizedData == "$value".lowercase()
}
}

View File

@@ -54,7 +54,7 @@ enum class StringCode(val value: kotlin.String) {
*/
fun decode(data: kotlin.Any?): StringCode? = data?.let {
val normalizedData = "$it".lowercase()
entries.firstOrNull { value ->
values().firstOrNull { value ->
it == value || normalizedData == "$value".lowercase()
}
}

View File

@@ -5480,9 +5480,9 @@
}
},
"node_modules/hono": {
"version": "4.11.7",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.7.tgz",
"integrity": "sha512-l7qMiNee7t82bH3SeyUCt9UF15EVmaBvsppY2zQtrbIhl/yzBTny+YUxsVjSjQ6gaqaeVtZmGocom8TzBlA4Yw==",
"version": "4.11.4",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.4.tgz",
"integrity": "sha512-U7tt8JsyrxSRKspfhtLET79pU8K+tInj5QZXs1jSugO1Vq5dFj3kmZsRldo29mTBfcjDRVRXrEZ6LS63Cog9ZA==",
"dev": true,
"license": "MIT",
"peer": true,
@@ -8736,9 +8736,9 @@
}
},
"node_modules/tar": {
"version": "7.5.7",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.7.tgz",
"integrity": "sha512-fov56fJiRuThVFXD6o6/Q354S7pnWMJIVlDBYijsTNx6jKSE4pvrDTs6lUnmGvNyfJwFQQwWy3owKz1ucIhveQ==",
"version": "7.5.6",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.6.tgz",
"integrity": "sha512-xqUeu2JAIJpXyvskvU3uvQW8PAmHrtXp2KDuMJwQqW8Sqq0CaZBAQ+dKS3RBXVhU4wC5NjAdKrmh84241gO9cA==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {

View File

@@ -7965,9 +7965,9 @@
"dev": true
},
"node_modules/hono": {
"version": "4.11.7",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.7.tgz",
"integrity": "sha512-l7qMiNee7t82bH3SeyUCt9UF15EVmaBvsppY2zQtrbIhl/yzBTny+YUxsVjSjQ6gaqaeVtZmGocom8TzBlA4Yw==",
"version": "4.11.4",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.4.tgz",
"integrity": "sha512-U7tt8JsyrxSRKspfhtLET79pU8K+tInj5QZXs1jSugO1Vq5dFj3kmZsRldo29mTBfcjDRVRXrEZ6LS63Cog9ZA==",
"dev": true,
"license": "MIT",
"peer": true,
@@ -12203,9 +12203,9 @@
}
},
"node_modules/tar": {
"version": "7.5.7",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.7.tgz",
"integrity": "sha512-fov56fJiRuThVFXD6o6/Q354S7pnWMJIVlDBYijsTNx6jKSE4pvrDTs6lUnmGvNyfJwFQQwWy3owKz1ucIhveQ==",
"version": "7.5.3",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.3.tgz",
"integrity": "sha512-ENg5JUHUm2rDD7IvKNFGzyElLXNjachNLp6RaGf4+JOgxXHkqA+gq81ZAMCUmtMtqBsoU62lcp6S27g1LCYGGQ==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {

View File

@@ -174,7 +174,6 @@ export class SelfDecodingBody implements ResponseBody {
reader.readAsText(data);
});
}
}
export class ResponseContext {

View File

@@ -174,7 +174,6 @@ export class SelfDecodingBody implements ResponseBody {
reader.readAsText(data);
});
}
}
export class ResponseContext {

View File

@@ -174,7 +174,6 @@ export class SelfDecodingBody implements ResponseBody {
reader.readAsText(data);
});
}
}
export class ResponseContext {

View File

@@ -174,7 +174,6 @@ export class SelfDecodingBody implements ResponseBody {
reader.readAsText(data);
});
}
}
export class ResponseContext {

View File

@@ -162,7 +162,6 @@ export class RequestContext {
export interface ResponseBody {
text(): Promise<string>;
binary(): Promise<Buffer>;
stream(): ReadableStream<Uint8Array> | null;
}
/**
@@ -179,10 +178,6 @@ export class SelfDecodingBody implements ResponseBody {
const data: Buffer = await this.dataSource;
return data.toString();
}
stream(): ReadableStream<Uint8Array> | null {
return null;
}
}
export class ResponseContext {

View File

@@ -22,8 +22,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
const body = {
text: () => resp.text(),
binary: () => resp.buffer(),
stream: () => resp.body
binary: () => resp.buffer()
};
return new ResponseContext(resp.status, headers, body);
});

View File

@@ -15,7 +15,7 @@
"@types/mocha": "^10.0.0",
"@types/node": "^22.12.0",
"chai": "^4.3.0",
"mocha": "^10.8.2",
"mocha": "^10.2.0",
"ts-node": "^10.9.0",
"typescript": "^5.6.3"
}
@@ -111,10 +111,9 @@
}
},
"node_modules/ansi-colors": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
"integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
"license": "MIT",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"engines": {
"node": ">=6"
}
@@ -166,8 +165,7 @@
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/binary-extensions": {
"version": "2.2.0",
@@ -178,12 +176,12 @@
}
},
"node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"license": "MIT",
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dependencies": {
"balanced-match": "^1.0.0"
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/braces": {
@@ -359,18 +357,22 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dependencies": {
"ms": "^2.1.3"
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
@@ -381,6 +383,11 @@
}
}
},
"node_modules/debug/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/decamelize": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
@@ -404,10 +411,9 @@
}
},
"node_modules/diff": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.2.tgz",
"integrity": "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A==",
"license": "BSD-3-Clause",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
"engines": {
"node": ">=0.3.1"
}
@@ -473,8 +479,7 @@
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"license": "ISC"
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/fsevents": {
"version": "2.3.3",
@@ -505,26 +510,6 @@
"node": "*"
}
},
"node_modules/glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@@ -556,8 +541,6 @@
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"license": "ISC",
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
@@ -566,8 +549,7 @@
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/is-binary-path": {
"version": "2.1.0",
@@ -679,44 +661,32 @@
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/mocha": {
"version": "10.8.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz",
"integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==",
"license": "MIT",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
"dependencies": {
"ansi-colors": "^4.1.3",
"browser-stdout": "^1.3.1",
"chokidar": "^3.5.3",
"debug": "^4.3.5",
"diff": "^5.2.0",
"escape-string-regexp": "^4.0.0",
"find-up": "^5.0.0",
"glob": "^8.1.0",
"he": "^1.2.0",
"js-yaml": "^4.1.0",
"log-symbols": "^4.1.0",
"minimatch": "^5.1.6",
"ms": "^2.1.3",
"serialize-javascript": "^6.0.2",
"strip-json-comments": "^3.1.1",
"supports-color": "^8.1.1",
"workerpool": "^6.5.1",
"yargs": "^16.2.0",
"yargs-parser": "^20.2.9",
"yargs-unparser": "^2.0.0"
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"chokidar": "3.5.3",
"debug": "4.3.4",
"diff": "5.0.0",
"escape-string-regexp": "4.0.0",
"find-up": "5.0.0",
"glob": "7.2.0",
"he": "1.2.0",
"js-yaml": "4.1.0",
"log-symbols": "4.1.0",
"minimatch": "5.0.1",
"ms": "2.1.3",
"nanoid": "3.3.3",
"serialize-javascript": "6.0.0",
"strip-json-comments": "3.1.1",
"supports-color": "8.1.1",
"workerpool": "6.2.1",
"yargs": "16.2.0",
"yargs-parser": "20.2.4",
"yargs-unparser": "2.0.0"
},
"bin": {
"_mocha": "bin/_mocha",
@@ -724,6 +694,59 @@
},
"engines": {
"node": ">= 14.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mochajs"
}
},
"node_modules/mocha/node_modules/glob": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/mocha/node_modules/glob/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/mocha/node_modules/minimatch": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/mocha/node_modules/minimatch/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/ms": {
@@ -731,6 +754,17 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/nanoid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
@@ -743,7 +777,6 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
@@ -784,6 +817,14 @@
"node": ">=8"
}
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/pathval": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
@@ -807,7 +848,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "^5.1.0"
}
@@ -848,14 +888,12 @@
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
]
},
"node_modules/serialize-javascript": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"license": "BSD-3-Clause",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
"integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
"dependencies": {
"randombytes": "^2.1.0"
}
@@ -958,10 +996,9 @@
}
},
"node_modules/ts-node/node_modules/diff": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
"integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==",
"license": "BSD-3-Clause",
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"engines": {
"node": ">=0.3.1"
}
@@ -998,10 +1035,9 @@
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
},
"node_modules/workerpool": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
"integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
"license": "Apache-2.0"
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw=="
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
@@ -1062,8 +1098,7 @@
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"license": "ISC"
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/y18n": {
"version": "5.0.8",
@@ -1091,10 +1126,9 @@
}
},
"node_modules/yargs-parser": {
"version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"license": "ISC",
"version": "20.2.4",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
"integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
"engines": {
"node": ">=10"
}

View File

@@ -6,7 +6,7 @@
"@types/mocha": "^10.0.0",
"@types/node": "^22.12.0",
"chai": "^4.3.0",
"mocha": "^10.8.2",
"mocha": "^10.2.0",
"ts-node": "^10.9.0",
"typescript": "^5.6.3"
},

View File

@@ -26,7 +26,6 @@ class TestServerStub implements PromiseHttpLibrary {
const body: ResponseBody = {
binary: async () => { throw new Error('not implemented') },
text: async () => JSON.stringify(value),
stream: () => null,
};
const headers = { 'content-type': 'application/json' };
return new ResponseContext(200, headers, body);
@@ -36,7 +35,6 @@ class TestServerStub implements PromiseHttpLibrary {
const body: ResponseBody = {
binary: async () => { throw new Error('not implemented') },
text: async () => "",
stream: () => null,
};
return new ResponseContext(200, {}, body);
} else {

View File

@@ -84,7 +84,7 @@ NestedOneOf <- R6::R6Class(
}
if (!is.null(self$`nested_pig`)) {
NestedOneOfObject[["nested_pig"]] <-
self$extractSimpleType(self$`nested_pig`)
self$`nested_pig`$toSimpleType()
}
for (key in names(self$additional_properties)) {
NestedOneOfObject[[key]] <- self$additional_properties[[key]]
@@ -93,29 +93,6 @@ NestedOneOf <- R6::R6Class(
return(NestedOneOfObject)
},
extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},
hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},
#' @description
#' Deserialize JSON string into an instance of NestedOneOf
#'

View File

@@ -121,7 +121,7 @@ Pet <- R6::R6Class(
}
if (!is.null(self$`category`)) {
PetObject[["category"]] <-
self$extractSimpleType(self$`category`)
self$`category`$toSimpleType()
}
if (!is.null(self$`name`)) {
PetObject[["name"]] <-
@@ -133,7 +133,7 @@ Pet <- R6::R6Class(
}
if (!is.null(self$`tags`)) {
PetObject[["tags"]] <-
self$extractSimpleType(self$`tags`)
lapply(self$`tags`, function(x) x$toSimpleType())
}
if (!is.null(self$`status`)) {
PetObject[["status"]] <-
@@ -146,29 +146,6 @@ Pet <- R6::R6Class(
return(PetObject)
},
extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},
hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},
#' @description
#' Deserialize JSON string into an instance of Pet
#'

View File

@@ -77,7 +77,7 @@ UpdatePetRequest <- R6::R6Class(
UpdatePetRequestObject <- list()
if (!is.null(self$`jsonData`)) {
UpdatePetRequestObject[["jsonData"]] <-
self$extractSimpleType(self$`jsonData`)
self$`jsonData`$toSimpleType()
}
if (!is.null(self$`binaryDataN2Information`)) {
UpdatePetRequestObject[["binaryDataN2Information"]] <-
@@ -90,29 +90,6 @@ UpdatePetRequest <- R6::R6Class(
return(UpdatePetRequestObject)
},
extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},
hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},
#' @description
#' Deserialize JSON string into an instance of UpdatePetRequest
#'

Some files were not shown because too many files have changed in this diff Show More