diff --git a/bin/generate-samples.sh b/bin/generate-samples.sh index a84ef4aa9ed..a92de09b4cb 100755 --- a/bin/generate-samples.sh +++ b/bin/generate-samples.sh @@ -10,6 +10,8 @@ if [ ! -f "$executable" ]; then (cd "${root}" && mvn -B --no-snapshot-updates clean package -DskipTests=true -Dmaven.javadoc.skip=true -Djacoco.skip=true) fi +# -ea -> enable assertions +# -server -> server version of the VM which has more complex optimizations, + is tuned to maximize performance export JAVA_OPTS="${JAVA_OPTS} -ea -server -Duser.timezone=UTC" export BATCH_OPTS="${BATCH_OPTS:-}" @@ -53,10 +55,10 @@ if [[ ${#files[@]} -eq 1 && "${files[0]}" != *'*'* ]]; then java ${JAVA_OPTS} -jar "$executable" generate -c ${files[0]} ${args[@]} else echo "Please press CTRL+C to stop or the script will continue in 5 seconds." - sleep 5 if [ ${#files[@]} -eq 0 ]; then files=("${root}"/bin/generate_samples_configs/*.yaml) fi + sleep 5 # shellcheck disable=SC2086 # shellcheck disable=SC2068 diff --git a/bin/generate_samples_configs/java_3_0_3_unit_test.yaml b/bin/generate_samples_configs/java_3_0_3_unit_test.yaml index bdd4baf6ee9..fcf39643017 100644 --- a/bin/generate_samples_configs/java_3_0_3_unit_test.yaml +++ b/bin/generate_samples_configs/java_3_0_3_unit_test.yaml @@ -2,5 +2,5 @@ generatorName: java outputDir: samples/client/3_0_3_unit_test/java inputSpec: src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec_nopaths.yaml additionalProperties: - artifactId: petstore + artifactId: unit-test-api hideGenerationTimestamp: "true" \ No newline at end of file diff --git a/bin/generate_samples_configs/java_3_1_0_unit_test.yaml b/bin/generate_samples_configs/java_3_1_0_unit_test.yaml index 873e2514255..e171ce79a27 100644 --- a/bin/generate_samples_configs/java_3_1_0_unit_test.yaml +++ b/bin/generate_samples_configs/java_3_1_0_unit_test.yaml @@ -2,4 +2,4 @@ generatorName: java outputDir: samples/client/3_1_0_unit_test/java inputSpec: src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec_nopaths.yaml additionalProperties: - packageName: unit_test_api + artifactId: unit-test-api diff --git a/docs/generators/java.md b/docs/generators/java.md index f9efbabe28f..93ff4abcfe7 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -12,7 +12,7 @@ title: Documentation for the java generator | generator language | Java | | | generator language version | 17 | | | generator default templating engine | handlebars | | -| helpTxt | Generates a Java client library

Features in this generator:
- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support
- Very thorough documentation generated in the style of javadocs
- Input types constrained for a Schema in SomeSchema.validate
- validate method can accept arbitrary List/Map/null/int/long/double/float/String json data
- Immutable List output classes generated and returned by validate for List<?> input
- Immutable Map output classes generated and returned by validate for Map<?, ?> input
- Strictly typed list input can be instantiated in client code using generated ListBuilders
- Strictly typed map input can be instantiated in client code using generated MapBuilders
- Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:
- `new MapBuilder().requiredA("a").requiredB("b").build()`
- `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()`
- Run time type checking and validation when
- validating schema payloads
- instantiating List output class (validation run)
- instantiating Map output class (validation run)
- Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods
- The [Checker-Framework's](https://github.com/typetools/checker-framework) NullnessChecker and @Nullable annotations are used in the java client
- ensuring that null pointer exceptions will not happen
- Invalid (in java) property names supported like `class`, `1var`, `hi-there` etc in
- component schema names
- schema property names (a fallback setter is written in the MapBuilder)
- Generated interfaces are largely consistent with the python code
- Openapi spec inline schemas supported at any depth in any location
- Format support for: int32, int64, float, double, date, datetime, uuid
- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string
- enum types are generated for enums of type string/integer/number/boolean/null
- String transmission of numbers supported with type: string, format: number | | +| helpMsg | Generates a Java client library

Features in this generator:
- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support
- Very thorough documentation generated in the style of javadocs
- Input types constrained for a Schema in SomeSchema.validate
- validate method can accept arbitrary List/Map/null/int/long/double/float/String json data
- Immutable List output classes generated and returned by validate for List<?> input
- Immutable Map output classes generated and returned by validate for Map<?, ?> input
- Strictly typed list input can be instantiated in client code using generated ListBuilders
- Strictly typed map input can be instantiated in client code using generated MapBuilders
- Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:
- `new MapBuilder().requiredA("a").requiredB("b").build()`
- `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()`
- Run time type checking and validation when
- validating schema payloads
- instantiating List output class (validation run)
- instantiating Map output class (validation run)
- Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods
- The [Checker-Framework's](https://github.com/typetools/checker-framework) NullnessChecker and @Nullable annotations are used in the java client
- ensuring that null pointer exceptions will not happen
- Invalid (in java) property names supported like `class`, `1var`, `hi-there` etc in
- component schema names
- schema property names (a fallback setter is written in the MapBuilder)
- Generated interfaces are largely consistent with the python code
- Openapi spec inline schemas supported at any depth in any location
- Format support for: int32, int64, float, double, date, datetime, uuid
- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string
- enum types are generated for enums of type string/integer/number/boolean/null
- String transmission of numbers supported with type: string, format: number | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. @@ -20,9 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| -|apiPackage|package for generated api classes| |apis| |artifactDescription|artifact description in generated pom.xml| |OpenAPI Java| -|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client| |artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| |artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| |developerEmail|developer email in generated pom.xml| |team@openapijsonschematools.org| @@ -30,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapijsonschematools.org| |groupId|groupId in generated pom.xml| |org.openapijsonschematools| -|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapijsonschematools.client| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/python.md b/docs/generators/python.md index 09e0602888b..b708155ae63 100644 --- a/docs/generators/python.md +++ b/docs/generators/python.md @@ -12,7 +12,7 @@ title: Documentation for the python generator | generator language | Python | | | generator language version | >=3.8 | | | generator default templating engine | handlebars | | -| helpTxt | Generates a Python client library

Features in this generator:
- type hints on endpoints and model creation
- model parameter names use the spec defined keys and cases
- robust composition (oneOf/anyOf/allOf/not) where payload data is stored in one instance only
- endpoint parameter names use the spec defined keys and cases
- inline schemas are supported at any location including composition
- multiple content types supported in request body and response bodies
- run time type checking + json schema validation
- json schema keyword validation may be selectively disabled with SchemaConfiguration
- enums of type string/integer/boolean typed using typing.Literal
- mypy static type checking run on generated sample
- Sending/receiving decimals as strings supported with type:string format: number -> DecimalSchema
- Sending/receiving uuids as strings supported with type:string format: uuid -> UUIDSchema
- quicker load time for python modules (a single endpoint can be imported and used without loading others)
- composed schemas with type constraints supported (type:object + oneOf/anyOf/allOf)
- schemas are not coerced/cast. For example string + date are both stored as string, and there is a date accessor | | +| helpMsg | Generates a Python client library

Features in this generator:
- type hints on endpoints and model creation
- model parameter names use the spec defined keys and cases
- robust composition (oneOf/anyOf/allOf/not) where payload data is stored in one instance only
- endpoint parameter names use the spec defined keys and cases
- inline schemas are supported at any location including composition
- multiple content types supported in request body and response bodies
- run time type checking + json schema validation
- json schema keyword validation may be selectively disabled with SchemaConfiguration
- enums of type string/integer/boolean typed using typing.Literal
- mypy static type checking run on generated sample
- Sending/receiving decimals as strings supported with type:string format: number -> DecimalSchema
- Sending/receiving uuids as strings supported with type:string format: uuid -> UUIDSchema
- quicker load time for python modules (a single endpoint can be imported and used without loading others)
- composed schemas with type constraints supported (type:object + oneOf/anyOf/allOf)
- schemas are not coerced/cast. For example string + date are both stored as string, and there is a date accessor | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. @@ -22,12 +22,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl |generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |nonCompliantUseDiscriminatorIfCompositionFails|When true, If the payload fails to validate against composed schemas (allOf/anyOf/oneOf/not) and a discriminator is present, then ignore the composition validation errors and attempt to use the discriminator to validate the payload.
Note: setting this to true makes the generated client not comply with json schema because it ignores composition validation errors. Please consider making your schemas more restrictive rather than setting this to true. You can do that by:|
**true**
If composition fails and a discriminator exists, the composition errors will be ignored and validation will be attempted with the discriminator
**false**
Composition validation must succeed. Discriminator validation must succeed.
|false| -|packageName|python package name (convention: snake_case).| |openapi_client| |packageUrl|python package URL.| |null| |packageVersion|python package version.| |1.0.0| |projectName|python project name in setup.py (e.g. petstore-api).| |null| |recursionLimit|Set the recursion limit. If not set, use the system default value.| |null| -|templatingEngine|template engine|
**handlebars**
handlebars templating engine
|handlebars| |useNose|use the nose test framework| |false| ## SUPPORTED VENDOR EXTENSIONS @@ -54,17 +52,16 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## LANGUAGE PRIMITIVES @@ -72,6 +69,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## RESERVED WORDS