Skip to content

Commit 3bf8ca7

Browse files
wing328spacether
andauthored
[python] Renames python generators (#7965)
* python->python-legacy, python-experimental->python * test with openjdk8 * test with openjdk11 * comment out rm * move kotlin tests to circleci * move kotlin tests * move tests to circleci * fix circleci * rearrange test * move tests * use wrapper Co-authored-by: Justin Black <[email protected]>
1 parent c08f145 commit 3bf8ca7

File tree

1,213 files changed

+40290
-38840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,213 files changed

+40290
-38840
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ Here is a list of template creators:
860860
* PHP (Guzzle): @baartosz
861861
* PowerShell: @beatcracker
862862
* PowerShell (refactored in 5.0.0): @wing328
863-
* Python-experimental: @spacether
863+
* Python: @spacether
864864
* R: @ramnov
865865
* Ruby (Faraday): @meganemura @dkliban
866866
* Rust: @farcaller

bin/configs/python-asyncio.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
generatorName: python
1+
generatorName: python-legacy
22
outputDir: samples/client/petstore/python-asyncio
33
library: asyncio
44
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
5-
templateDir: modules/openapi-generator/src/main/resources/python
5+
templateDir: modules/openapi-generator/src/main/resources/python-legacy
66
additionalProperties:
77
packageName: petstore_api

bin/configs/python-experimental-oas2.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

bin/configs/python-experimental.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

bin/configs/python-experimental-extensions-x-auth-id-alias.yaml renamed to bin/configs/python-extensions-x-auth-id-alias.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
generatorName: python-experimental
2-
outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/
1+
generatorName: python
2+
outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python/
33
inputSpec: modules/openapi-generator/src/test/resources/3_0/extensions/x-auth-id-alias.yaml
44
templateDir: modules/openapi-generator/src/main/resources/python
55
additionalProperties:

bin/configs/python-experimental-features-dynamic-servers.yaml renamed to bin/configs/python-features-dynamic-servers.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
generatorName: python-experimental
2-
outputDir: samples/openapi3/client/features/dynamic-servers/python-experimental/
1+
generatorName: python
2+
outputDir: samples/openapi3/client/features/dynamic-servers/python/
33
inputSpec: modules/openapi-generator/src/test/resources/3_0/features/dynamic-servers.yaml
44
templateDir: modules/openapi-generator/src/main/resources/python
55
additionalProperties:

bin/configs/python-legacy-oas2.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generatorName: python-legacy
2+
outputDir: samples/client/petstore/python-legacy
3+
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/python-legacy
5+
additionalProperties:
6+
packageName: petstore_api

bin/configs/python-legacy.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generatorName: python-legacy
2+
outputDir: samples/openapi3/client/petstore/python-legacy
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/python-legacy
5+
additionalProperties:
6+
packageName: petstore_api

bin/configs/python-oas2.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
generatorName: python
22
outputDir: samples/client/petstore/python
3-
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
3+
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
44
templateDir: modules/openapi-generator/src/main/resources/python
55
additionalProperties:
6+
disallowAdditionalPropertiesIfNotPresent: "true"
67
packageName: petstore_api

bin/configs/python-tornado.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
generatorName: python
1+
generatorName: python-legacy
22
outputDir: samples/client/petstore/python-tornado
33
library: tornado
44
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
5-
templateDir: modules/openapi-generator/src/main/resources/python
5+
templateDir: modules/openapi-generator/src/main/resources/python-legacy
66
additionalProperties:
77
packageName: petstore_api

bin/configs/python.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
generatorName: python
22
outputDir: samples/openapi3/client/petstore/python
3-
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
44
templateDir: modules/openapi-generator/src/main/resources/python
55
additionalProperties:
66
packageName: petstore_api
7+
recursionLimit: "1234"

docs/generators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ The following generators are available:
4848
* [perl](generators/perl.md)
4949
* [php](generators/php.md)
5050
* [powershell (beta)](generators/powershell.md)
51-
* [python](generators/python.md)
52-
* [python-experimental (experimental)](generators/python-experimental.md)
51+
* [python (experimental)](generators/python.md)
52+
* [python-legacy](generators/python-legacy.md)
5353
* [r](generators/r.md)
5454
* [ruby](generators/ruby.md)
5555
* [rust](generators/rust.md)

docs/generators/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ The following generators are available:
4040
* [perl](perl.md)
4141
* [php](php.md)
4242
* [powershell](powershell.md)
43-
* [python](python.md)
44-
* [python-experimental (experimental)](python-experimental.md)
43+
* [python](python.md)
44+
* [python-legacy](python-legacy.md)
4545
* [r](r.md)
4646
* [ruby](ruby.md)
4747
* [rust](rust.md)

docs/generators/python-experimental.md renamed to docs/generators/python-legacy.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Config Options for python-experimental
3-
sidebar_label: python-experimental
2+
title: Config Options for python-legacy
3+
sidebar_label: python-legacy
44
---
55

66
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.
@@ -14,8 +14,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
1414
|packageUrl|python package URL.| |null|
1515
|packageVersion|python package version.| |1.0.0|
1616
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
17-
|pythonAttrNoneIfUnset|when accessing unset attribute, return `None` instead of raising `ApiAttributeError`| |false|
1817
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
18+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
1919
|useNose|use the nose test framework| |false|
2020

2121
## IMPORT MAPPING
@@ -28,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2828

2929
| Type/Alias | Instantiated By |
3030
| ---------- | --------------- |
31-
|map|dict|
3231

3332

3433
## LANGUAGE PRIMITIVES
@@ -40,11 +39,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
4039
<li>datetime</li>
4140
<li>dict</li>
4241
<li>file</li>
43-
<li>file_type</li>
4442
<li>float</li>
4543
<li>int</li>
4644
<li>list</li>
47-
<li>none_type</li>
4845
<li>object</li>
4946
<li>str</li>
5047
</ul>
@@ -167,7 +164,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
167164
|Examples|✓|OAS2,OAS3
168165
|XMLStructureDefinitions|✗|OAS2,OAS3
169166
|MultiServer|✗|OAS3
170-
|ParameterizedServer||OAS3
167+
|ParameterizedServer||OAS3
171168
|ParameterStyling|✗|OAS3
172169
|Callbacks|✗|OAS3
173170
|LinkObjects|✗|OAS3

docs/generators/python.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
1414
|packageUrl|python package URL.| |null|
1515
|packageVersion|python package version.| |1.0.0|
1616
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
17+
|pythonAttrNoneIfUnset|when accessing unset attribute, return `None` instead of raising `ApiAttributeError`| |false|
1718
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
18-
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
1919
|useNose|use the nose test framework| |false|
2020

2121
## IMPORT MAPPING
@@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2828

2929
| Type/Alias | Instantiated By |
3030
| ---------- | --------------- |
31+
|map|dict|
3132

3233

3334
## LANGUAGE PRIMITIVES
@@ -39,9 +40,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
3940
<li>datetime</li>
4041
<li>dict</li>
4142
<li>file</li>
43+
<li>file_type</li>
4244
<li>float</li>
4345
<li>int</li>
4446
<li>list</li>
47+
<li>none_type</li>
4548
<li>object</li>
4649
<li>str</li>
4750
</ul>
@@ -164,7 +167,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
164167
|Examples|✓|OAS2,OAS3
165168
|XMLStructureDefinitions|✗|OAS2,OAS3
166169
|MultiServer|✗|OAS3
167-
|ParameterizedServer||OAS3
170+
|ParameterizedServer||OAS3
168171
|ParameterStyling|✗|OAS3
169172
|Callbacks|✗|OAS3
170173
|LinkObjects|✗|OAS3

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import org.openapitools.codegen.api.TemplatingEngineAdapter;
4242
import org.openapitools.codegen.api.TemplateFileType;
4343
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
44-
import org.openapitools.codegen.languages.PythonClientExperimentalCodegen;
44+
import org.openapitools.codegen.languages.PythonClientCodegen;
4545
import org.openapitools.codegen.meta.GeneratorMetadata;
4646
import org.openapitools.codegen.meta.Stability;
4747
import org.openapitools.codegen.serializer.SerializerUtils;
@@ -520,9 +520,9 @@ void generateModels(List<File> files, List<Object> allModels, List<String> unuse
520520
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
521521
if (modelTemplate != null && modelTemplate.containsKey("model")) {
522522
CodegenModel m = (CodegenModel) modelTemplate.get("model");
523-
if (m.isAlias && !(config instanceof PythonClientExperimentalCodegen)) {
523+
if (m.isAlias && !(config instanceof PythonClientCodegen)) {
524524
// alias to number, string, enum, etc, which should not be generated as model
525-
// for PythonClientExperimentalCodegen, all aliases are generated as models
525+
// for PythonClientCodegen, all aliases are generated as models
526526
continue; // Don't create user-defined classes for aliases
527527
}
528528
}

0 commit comments

Comments
 (0)