Skip to content

[python] Renames python generators #7965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ Here is a list of template creators:
* PHP (Guzzle): @baartosz
* PowerShell: @beatcracker
* PowerShell (refactored in 5.0.0): @wing328
* Python-experimental: @spacether
* Python: @spacether
* R: @ramnov
* Ruby (Faraday): @meganemura @dkliban
* Rust: @farcaller
Expand Down
4 changes: 2 additions & 2 deletions bin/configs/python-asyncio.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generatorName: python
generatorName: python-legacy
outputDir: samples/client/petstore/python-asyncio
library: asyncio
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
templateDir: modules/openapi-generator/src/main/resources/python-legacy
additionalProperties:
packageName: petstore_api
7 changes: 0 additions & 7 deletions bin/configs/python-experimental-oas2.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions bin/configs/python-experimental.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generatorName: python-experimental
outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/
generatorName: python
outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python/
inputSpec: modules/openapi-generator/src/test/resources/3_0/extensions/x-auth-id-alias.yaml
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generatorName: python-experimental
outputDir: samples/openapi3/client/features/dynamic-servers/python-experimental/
generatorName: python
outputDir: samples/openapi3/client/features/dynamic-servers/python/
inputSpec: modules/openapi-generator/src/test/resources/3_0/features/dynamic-servers.yaml
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
Expand Down
6 changes: 6 additions & 0 deletions bin/configs/python-legacy-oas2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
generatorName: python-legacy
outputDir: samples/client/petstore/python-legacy
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python-legacy
additionalProperties:
packageName: petstore_api
6 changes: 6 additions & 0 deletions bin/configs/python-legacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
generatorName: python-legacy
outputDir: samples/openapi3/client/petstore/python-legacy
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python-legacy
additionalProperties:
packageName: petstore_api
3 changes: 2 additions & 1 deletion bin/configs/python-oas2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
generatorName: python
outputDir: samples/client/petstore/python
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
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
additionalProperties:
disallowAdditionalPropertiesIfNotPresent: "true"
packageName: petstore_api
4 changes: 2 additions & 2 deletions bin/configs/python-tornado.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generatorName: python
generatorName: python-legacy
outputDir: samples/client/petstore/python-tornado
library: tornado
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
templateDir: modules/openapi-generator/src/main/resources/python-legacy
additionalProperties:
packageName: petstore_api
3 changes: 2 additions & 1 deletion bin/configs/python.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
generatorName: python
outputDir: samples/openapi3/client/petstore/python
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
recursionLimit: "1234"
4 changes: 2 additions & 2 deletions docs/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ The following generators are available:
* [perl](generators/perl.md)
* [php](generators/php.md)
* [powershell (beta)](generators/powershell.md)
* [python](generators/python.md)
* [python-experimental (experimental)](generators/python-experimental.md)
* [python (experimental)](generators/python.md)
* [python-legacy](generators/python-legacy.md)
* [r](generators/r.md)
* [ruby](generators/ruby.md)
* [rust](generators/rust.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/generators/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ The following generators are available:
* [perl](perl.md)
* [php](php.md)
* [powershell](powershell.md)
* [python](python.md)
* [python-experimental (experimental)](python-experimental.md)
* [python](python.md)
* [python-legacy](python-legacy.md)
* [r](r.md)
* [ruby](ruby.md)
* [rust](rust.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Config Options for python-experimental
sidebar_label: python-experimental
title: Config Options for python-legacy
sidebar_label: python-legacy
---

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.
Expand All @@ -14,8 +14,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|useNose|use the nose test framework| |false|

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

| Type/Alias | Instantiated By |
| ---------- | --------------- |
|map|dict|


## LANGUAGE PRIMITIVES
Expand All @@ -40,11 +39,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>datetime</li>
<li>dict</li>
<li>file</li>
<li>file_type</li>
<li>float</li>
<li>int</li>
<li>list</li>
<li>none_type</li>
<li>object</li>
<li>str</li>
</ul>
Expand Down Expand Up @@ -167,7 +164,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer||OAS3
|ParameterizedServer||OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
Expand Down
7 changes: 5 additions & 2 deletions docs/generators/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|useNose|use the nose test framework| |false|

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

| Type/Alias | Instantiated By |
| ---------- | --------------- |
|map|dict|


## LANGUAGE PRIMITIVES
Expand All @@ -39,9 +40,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>datetime</li>
<li>dict</li>
<li>file</li>
<li>file_type</li>
<li>float</li>
<li>int</li>
<li>list</li>
<li>none_type</li>
<li>object</li>
<li>str</li>
</ul>
Expand Down Expand Up @@ -164,7 +167,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer||OAS3
|ParameterizedServer||OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.openapitools.codegen.api.TemplatingEngineAdapter;
import org.openapitools.codegen.api.TemplateFileType;
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
import org.openapitools.codegen.languages.PythonClientExperimentalCodegen;
import org.openapitools.codegen.languages.PythonClientCodegen;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.serializer.SerializerUtils;
Expand Down Expand Up @@ -520,9 +520,9 @@ void generateModels(List<File> files, List<Object> allModels, List<String> unuse
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
if (modelTemplate != null && modelTemplate.containsKey("model")) {
CodegenModel m = (CodegenModel) modelTemplate.get("model");
if (m.isAlias && !(config instanceof PythonClientExperimentalCodegen)) {
if (m.isAlias && !(config instanceof PythonClientCodegen)) {
// alias to number, string, enum, etc, which should not be generated as model
// for PythonClientExperimentalCodegen, all aliases are generated as models
// for PythonClientCodegen, all aliases are generated as models
continue; // Don't create user-defined classes for aliases
}
}
Expand Down
Loading