Switches python-experimental in as the primary python client (#13501)

* Changes python to python-prior

* python -> python-prior, python-experimental->python

* Renames sample spec directories

* Samples regnerated

* Regenerates docs

* Fixes test

* Samples regenerated

* Updates renerators list

* Fixes made to python paths in pom.xml

* Fixes node4 sh file paths
This commit is contained in:
Justin Black 2022-09-24 01:19:38 -07:00 committed by GitHub
parent 9d621342e0
commit 7e73645303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3628 changed files with 49326 additions and 45313 deletions

View File

@ -79,8 +79,8 @@ elif [ "$NODE_INDEX" = "4" ]; then
#mvn --no-snapshot-updates --quiet verify -Psamples.circleci.node4 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
(cd samples/openapi3/client/petstore/python && make test)
(cd samples/openapi3/client/petstore/python-experimental && make test)
(cd samples/openapi3/client/3_0_3_unit_test/python-experimental && make test)
(cd samples/openapi3/client/petstore/python-prior && make test)
(cd samples/openapi3/client/3_0_3_unit_test/python && make test)
else
echo "Running node $NODE_INDEX to test 'samples.circleci.others' defined in pom.xml ..."

View File

@ -1,5 +1,5 @@
generatorName: python
outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python/
generatorName: python-prior
outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python-prior/
inputSpec: modules/openapi-generator/src/test/resources/3_0/extensions/x-auth-id-alias.yaml
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:

View File

@ -2,9 +2,9 @@
# which makes it default to false
# that false setting is needed for composed schemas to work
# Composed schemas are schemas that contain the allOf/oneOf/anyOf keywords. v2 specs only support the allOf keyword.
generatorName: python
outputDir: samples/client/petstore/python
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
generatorName: python-prior
outputDir: samples/client/petstore/python-prior
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-prior/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python-prior
additionalProperties:
packageName: petstore_api

View File

@ -1,7 +1,7 @@
generatorName: python
outputDir: samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
generatorName: python-prior
outputDir: samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-prior/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python-prior
additionalProperties:
disallowAdditionalPropertiesIfNotPresent: "true"
packageName: petstore_api

View File

@ -1,7 +1,8 @@
generatorName: python-experimental
outputDir: samples/openapi3/client/petstore/python-experimental
inputSpec: modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/python-experimental
generatorName: python-prior
outputDir: samples/openapi3/client/petstore/python-prior
inputSpec: modules/openapi-generator/src/test/resources/3_0/python-prior/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/python-prior
additionalProperties:
packageName: petstore_api
recursionLimit: "1234"
initRequiredVars: false

View File

@ -5,4 +5,3 @@ templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
recursionLimit: "1234"
initRequiredVars: false

View File

@ -1,6 +1,6 @@
generatorName: python-experimental
outputDir: samples/openapi3/client/3_0_3_unit_test/python-experimental
generatorName: python
outputDir: samples/openapi3/client/3_0_3_unit_test/python
inputSpec: modules/openapi-generator/src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml
templateDir: modules/openapi-generator/src/main/resources/python-experimental
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: unit_test_api

View File

@ -50,8 +50,8 @@ The following generators are available:
* [php-dt (beta)](generators/php-dt.md)
* [powershell (beta)](generators/powershell.md)
* [python](generators/python.md)
* [python-experimental (experimental)](generators/python-experimental.md)
* [python-legacy](generators/python-legacy.md)
* [python-prior](generators/python-prior.md)
* [r](generators/r.md)
* [ruby](generators/ruby.md)
* [rust](generators/rust.md)

View File

@ -1,33 +1,35 @@
---
title: Documentation for the python-experimental Generator
title: Documentation for the python-prior Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | python-experimental | pass this to the generate command after -g |
| generator stability | EXPERIMENTAL | |
| generator name | python-prior | pass this to the generate command after -g |
| generator stability | STABLE | |
| generator type | CLIENT | |
| generator language | Python | |
| generator language version | >=3.7 | |
| generator default templating engine | handlebars | |
| helpTxt | Generates a Python client library<br /><br />Features in this generator:<br />- type hints on endpoints and model creation<br />- model parameter names use the spec defined keys and cases<br />- robust composition (oneOf/anyOf/allOf/not) where payload data is stored in one instance only<br />- endpoint parameter names use the spec defined keys and cases<br />- inline schemas are supported at any location including composition<br />- multiple content types supported in request body and response bodies<br />- run time type checking<br />- Sending/receiving decimals as strings supported with type:string format: number -> DecimalSchema<br />- Sending/receiving uuids as strings supported with type:string format: uuid -> UUIDSchema<br />- quicker load time for python modules (a single endpoint can be imported and used without loading others)<br />- all instances of schemas dynamically inherit from all matching schemas so one can use isinstance to check if validation passed<br />- composed schemas with type constraints supported (type:object + oneOf/anyOf/allOf)<br />- schemas are not coerced/cast. For example string + date are both stored as string, and there is a date accessor<br /> - Exceptions: int/float is stored as Decimal, When receiving data from headers it will start as str and may need to be cast for example to int | |
| generator language version | >=3.6 | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python client library. | |
## 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.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|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. NOTE: this option breaks composition and will be removed in 6.0.0</dd></dl>|false|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|library|library template (sub-template) to use: urllib3| |urllib3|
|initRequiredVars|If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.| |false|
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
|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|
|pythonAttrNoneIfUnset|when accessing unset attribute, return `None` instead of raising `ApiAttributeError`| |false|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|useInlineModelResolver|use the inline model resolver, if true inline complex models will be extracted into components and $refs to them will be used| |false|
|useNose|use the nose test framework| |false|
## IMPORT MAPPING
@ -40,7 +42,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|map|dict|
## LANGUAGE PRIMITIVES
@ -72,37 +73,29 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>auth_settings</li>
<li>await</li>
<li>body_params</li>
<li>bool</li>
<li>break</li>
<li>class</li>
<li>continue</li>
<li>def</li>
<li>del</li>
<li>dict</li>
<li>elif</li>
<li>else</li>
<li>except</li>
<li>exec</li>
<li>false</li>
<li>file_type</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>form_params</li>
<li>from</li>
<li>frozendict</li>
<li>global</li>
<li>header_params</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>int</li>
<li>is</li>
<li>lambda</li>
<li>list</li>
<li>local_var_files</li>
<li>none</li>
<li>none_type</li>
<li>nonlocal</li>
<li>not</li>
<li>or</li>
@ -115,10 +108,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>resource_path</li>
<li>return</li>
<li>self</li>
<li>str</li>
<li>true</li>
<li>try</li>
<li>tuple</li>
<li>while</li>
<li>with</li>
<li>yield</li>
@ -152,10 +143,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid||
|Uuid||
|Array|✓|OAS2,OAS3
|Null||OAS3
|AnyType||OAS2,OAS3
|Null||OAS3
|AnyType||OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
@ -194,7 +185,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✓|OAS3
|ParameterStyling||OAS3
|ParameterStyling||OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
@ -214,12 +205,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism||OAS2,OAS3
|Union||OAS3
|allOf||OAS2,OAS3
|anyOf||OAS3
|oneOf||OAS3
|not||OAS3
|Polymorphism||OAS2,OAS3
|Union||OAS3
|allOf||OAS2,OAS3
|anyOf||OAS3
|oneOf||OAS3
|not||OAS3
### Security Feature
| Name | Supported | Defined By |
@ -237,6 +228,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML||OAS2,OAS3
|XML||OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@ -10,26 +10,24 @@ title: Documentation for the python Generator
| generator stability | STABLE | |
| generator type | CLIENT | |
| generator language | Python | |
| generator language version | >=3.6 | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python client library. | |
| generator language version | >=3.7 | |
| generator default templating engine | handlebars | |
| helpTxt | Generates a Python client library<br /><br />Features in this generator:<br />- type hints on endpoints and model creation<br />- model parameter names use the spec defined keys and cases<br />- robust composition (oneOf/anyOf/allOf/not) where payload data is stored in one instance only<br />- endpoint parameter names use the spec defined keys and cases<br />- inline schemas are supported at any location including composition<br />- multiple content types supported in request body and response bodies<br />- run time type checking<br />- Sending/receiving decimals as strings supported with type:string format: number -> DecimalSchema<br />- Sending/receiving uuids as strings supported with type:string format: uuid -> UUIDSchema<br />- quicker load time for python modules (a single endpoint can be imported and used without loading others)<br />- all instances of schemas dynamically inherit from all matching schemas so one can use isinstance to check if validation passed<br />- composed schemas with type constraints supported (type:object + oneOf/anyOf/allOf)<br />- schemas are not coerced/cast. For example string + date are both stored as string, and there is a date accessor<br /> - Exceptions: int/float is stored as Decimal, When receiving data from headers it will start as str and may need to be cast for example to int | |
## 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.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|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. NOTE: this option breaks composition and will be removed in 6.0.0</dd></dl>|false|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|initRequiredVars|If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.| |false|
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
|library|library template (sub-template) to use: urllib3| |urllib3|
|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|
|pythonAttrNoneIfUnset|when accessing unset attribute, return `None` instead of raising `ApiAttributeError`| |false|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|useInlineModelResolver|use the inline model resolver, if true inline complex models will be extracted into components and $refs to them will be used| |false|
|useNose|use the nose test framework| |false|
## IMPORT MAPPING
@ -42,6 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|map|dict|
## LANGUAGE PRIMITIVES
@ -73,29 +72,37 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>auth_settings</li>
<li>await</li>
<li>body_params</li>
<li>bool</li>
<li>break</li>
<li>class</li>
<li>continue</li>
<li>def</li>
<li>del</li>
<li>dict</li>
<li>elif</li>
<li>else</li>
<li>except</li>
<li>exec</li>
<li>false</li>
<li>file_type</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>form_params</li>
<li>from</li>
<li>frozendict</li>
<li>global</li>
<li>header_params</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>int</li>
<li>is</li>
<li>lambda</li>
<li>list</li>
<li>local_var_files</li>
<li>none</li>
<li>none_type</li>
<li>nonlocal</li>
<li>not</li>
<li>or</li>
@ -108,8 +115,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>resource_path</li>
<li>return</li>
<li>self</li>
<li>str</li>
<li>true</li>
<li>try</li>
<li>tuple</li>
<li>while</li>
<li>with</li>
<li>yield</li>
@ -143,10 +152,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid||
|Uuid||
|Array|✓|OAS2,OAS3
|Null||OAS3
|AnyType||OAS2,OAS3
|Null||OAS3
|AnyType||OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
@ -185,7 +194,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✓|OAS3
|ParameterStyling||OAS3
|ParameterStyling||OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
@ -205,12 +214,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism||OAS2,OAS3
|Union||OAS3
|allOf||OAS2,OAS3
|anyOf||OAS3
|oneOf||OAS3
|not||OAS3
|Polymorphism||OAS2,OAS3
|Union||OAS3
|allOf||OAS2,OAS3
|anyOf||OAS3
|oneOf||OAS3
|not||OAS3
### Security Feature
| Name | Supported | Defined By |
@ -228,6 +237,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML||OAS2,OAS3
|XML||OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@ -40,8 +40,8 @@ import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.api.TemplatingEngineAdapter;
import org.openapitools.codegen.api.TemplateFileType;
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
import org.openapitools.codegen.languages.PythonPriorClientCodegen;
import org.openapitools.codegen.languages.PythonClientCodegen;
import org.openapitools.codegen.languages.PythonExperimentalClientCodegen;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.model.ApiInfoMap;
@ -541,7 +541,7 @@ public class DefaultGenerator implements Generator {
ModelMap modelTemplate = modelList.get(0);
if (modelTemplate != null && modelTemplate.getModel() != null) {
CodegenModel m = modelTemplate.getModel();
if (m.isAlias && !((config instanceof PythonClientCodegen) || (config instanceof PythonExperimentalClientCodegen))) {
if (m.isAlias && !((config instanceof PythonPriorClientCodegen) || (config instanceof PythonClientCodegen))) {
// alias to number, string, enum, etc, which should not be generated as model
// for PythonClientCodegen, all aliases are generated as models
continue; // Don't create user-defined classes for aliases

View File

@ -98,7 +98,7 @@ org.openapitools.codegen.languages.ProtobufSchemaCodegen
org.openapitools.codegen.languages.PythonLegacyClientCodegen
org.openapitools.codegen.languages.PythonClientCodegen
org.openapitools.codegen.languages.PythonFastAPIServerCodegen
org.openapitools.codegen.languages.PythonExperimentalClientCodegen
org.openapitools.codegen.languages.PythonPriorClientCodegen
org.openapitools.codegen.languages.PythonFlaskConnexionServerCodegen
org.openapitools.codegen.languages.PythonAiohttpConnexionServerCodegen
org.openapitools.codegen.languages.PythonBluePlanetServerCodegen

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