diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md
index d2ba3f9ec02..2f6f7e4e510 100644
--- a/docs/generators/python-aiohttp.md
+++ b/docs/generators/python-aiohttp.md
@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|TCP port to listen to in app.run| |8080|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
-|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|testsUsePythonSrcRoot|generates test under the pythonSrcRoot folder.| |false|
|useNose|use the nose test framework| |false|
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md
index 9e10d91343f..ce4b7ae98dd 100644
--- a/docs/generators/python-blueplanet.md
+++ b/docs/generators/python-blueplanet.md
@@ -10,7 +10,7 @@ title: Documentation for the python-blueplanet Generator
| generator stability | STABLE | |
| generator type | SERVER | |
| generator language | Python | |
-| generator language version | 2.7+ and 3.5.2+ | |
+| generator language version | 3.5.2+ | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python server library using the Connexion project. By default, it will also generate service classes -- which you can disable with the `-Dnoservice` environment variable. | |
@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|TCP port to listen to in app.run| |8080|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
-|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|testsUsePythonSrcRoot|generates test under the pythonSrcRoot folder.| |false|
|useNose|use the nose test framework| |false|
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md
index 2c82d539007..5624ecb8a04 100644
--- a/docs/generators/python-flask.md
+++ b/docs/generators/python-flask.md
@@ -10,7 +10,7 @@ title: Documentation for the python-flask Generator
| generator stability | STABLE | |
| generator type | SERVER | |
| generator language | Python | |
-| generator language version | 2.7 and 3.5.2+ | |
+| generator language version | 3.5.2+ | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python server library using the Connexion project. By default, it will also generate service classes -- which you can disable with the `-Dnoservice` environment variable. | |
@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|TCP port to listen to in app.run| |8080|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
-|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|testsUsePythonSrcRoot|generates test under the pythonSrcRoot folder.| |false|
|useNose|use the nose test framework| |false|
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
index 38cd718f857..5f0f932c8d9 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
@@ -65,7 +65,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
public static final String CONTROLLER_PACKAGE = "controllerPackage";
public static final String DEFAULT_CONTROLLER = "defaultController";
- public static final String SUPPORT_PYTHON2 = "supportPython2";
public static final String FEATURE_CORS = "featureCORS";
// nose is a python testing framework, we use pytest if USE_NOSE is unset
public static final String USE_NOSE = "useNose";
@@ -152,8 +151,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
defaultValue("controllers"));
cliOptions.add(new CliOption(DEFAULT_CONTROLLER, "default controller").
defaultValue("default_controller"));
- cliOptions.add(new CliOption(SUPPORT_PYTHON2, "support python2. This option has been deprecated and will be removed in the 5.x release.").
- defaultValue("false"));
cliOptions.add(new CliOption("serverPort", "TCP port to listen to in app.run").
defaultValue("8080"));
cliOptions.add(CliOption.newBoolean(FEATURE_CORS, "use flask-cors for handling CORS requests").
@@ -200,10 +197,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
this.defaultController = "default_controller";
additionalProperties.put(DEFAULT_CONTROLLER, this.defaultController);
}
- if (Boolean.TRUE.equals(additionalProperties.get(SUPPORT_PYTHON2))) {
- additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE);
- typeMapping.put("long", "long");
- }
if (additionalProperties.containsKey(FEATURE_CORS)) {
setFeatureCORS(String.valueOf(additionalProperties.get(FEATURE_CORS)));
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonBluePlanetServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonBluePlanetServerCodegen.java
index fd381e52974..5f5b8852e19 100755
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonBluePlanetServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonBluePlanetServerCodegen.java
@@ -101,10 +101,6 @@ public class PythonBluePlanetServerCodegen extends AbstractPythonConnexionServer
this.defaultController = "default_controller";
additionalProperties.put(DEFAULT_CONTROLLER, this.defaultController);
}
- if (Boolean.TRUE.equals(additionalProperties.get(SUPPORT_PYTHON2))) {
- additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE);
- typeMapping.put("long", "long");
- }
String APP_PATH = "app" + File.separatorChar;
String APP_PACKAGE_PATH = APP_PATH + packageName;
@@ -266,5 +262,5 @@ public class PythonBluePlanetServerCodegen extends AbstractPythonConnexionServer
}
@Override
- public String generatorLanguageVersion() { return "2.7+ and 3.5.2+"; };
+ public String generatorLanguageVersion() { return "3.5.2+"; };
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java
index a9358b4007a..f667f7b6fca 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java
@@ -56,5 +56,5 @@ public class PythonFlaskConnexionServerCodegen extends AbstractPythonConnexionSe
}
@Override
- public String generatorLanguageVersion() { return "2.7 and 3.5.2+"; };
+ public String generatorLanguageVersion() { return "3.5.2+"; };
}
diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/requirements.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/requirements.mustache
index b828c50f4a2..e2ef30b1d41 100644
--- a/modules/openapi-generator/src/main/resources/python-aiohttp/requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-aiohttp/requirements.mustache
@@ -5,8 +5,8 @@ connexion[aiohttp,swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=
# we must peg werkzeug versions below to fix connexion
# https://github.com/zalando/connexion/pull/1044
werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
-swagger-ui-bundle == 0.0.6
-aiohttp_jinja2 == 1.2.0
+swagger-ui-bundle == 0.0.9
+aiohttp_jinja2 == 1.5.0
{{#featureCORS}}
aiohttp_cors >= 0.7.0
{{/featureCORS}}
diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/setup.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/setup.mustache
index 364384593d9..706eab4f505 100644
--- a/modules/openapi-generator/src/main/resources/python-aiohttp/setup.mustache
+++ b/modules/openapi-generator/src/main/resources/python-aiohttp/setup.mustache
@@ -14,9 +14,9 @@ VERSION = "{{packageVersion}}"
# http://pypi.python.org/pypi/setuptools
REQUIRES = [
- "connexion==2.6.0",
- "swagger-ui-bundle==0.0.6",
- "aiohttp_jinja2==1.2.0",
+ "connexion==2.14.1",
+ "swagger-ui-bundle==0.0.9",
+ "aiohttp_jinja2==1.5.0",
]
setup(
diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache
index 16ba4a48111..a408e178b36 100644
--- a/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache
@@ -6,8 +6,8 @@ py>=1.4.31
randomize>=0.13
{{/useNose}}
{{^useNose}}
-pytest~=4.6.7 # needed for python 2.7+3.4
+pytest~=7.1.0
pytest-cov>=2.8.1
-pytest-randomly==1.2.3 # needed for python 2.7+3.4
+pytest-randomly>=1.2.3
pytest-aiohttp>=0.3.0
{{/useNose}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/Dockerfile.mustache
index d96f8f2cc39..f93e0452605 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/Dockerfile.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/Dockerfile.mustache
@@ -1,9 +1,4 @@
-{{#supportPython2}}
-FROM python:2-alpine
-{{/supportPython2}}
-{{^supportPython2}}
FROM python:3-alpine
-{{/supportPython2}}
ARG GLTOKEN
@@ -19,12 +14,7 @@ WORKDIR /bp2/src
COPY requirements.txt /bp2/src
-{{#supportPython2}}
-RUN pip install --extra-index-url https://GLTOKEN:$GLTOKEN@pypi.blueplanet.com/simple --no-cache-dir -r requirements.txt
-{{/supportPython2}}
-{{^supportPython2}}
RUN pip3 install --extra-index-url https://GLTOKEN:$GLTOKEN@pypi.blueplanet.com/simple --no-cache-dir -r requirements.txt
-{{/supportPython2}}
COPY . /bp2/src
@@ -33,11 +23,6 @@ ENV SBIS=bpocore \
EXPOSE {{serverPort}}
-{{#supportPython2}}
-ENTRYPOINT ["python"]
-{{/supportPython2}}
-{{^supportPython2}}
ENTRYPOINT ["python3"]
-{{/supportPython2}}
CMD ["-B", "-m", "{{packageName}}"]
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/README.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/README.mustache
index b73b9e311b0..2c62f0f01a6 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/README.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/README.mustache
@@ -8,25 +8,14 @@ is an example of building a swagger-enabled Flask server.
This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.
## Requirements
-{{#supportPython2}}
-Python 2.7+
-{{/supportPython2}}
-{{^supportPython2}}
Python 3.5.2+
-{{/supportPython2}}
## Usage
To run the server, please execute the following from the root directory:
```
-{{#supportPython2}}
-pip install -r requirements.txt
-python -m {{packageName}}
-{{/supportPython2}}
-{{^supportPython2}}
pip3 install -r requirements.txt
python3 -m {{packageName}}
-{{/supportPython2}}
```
and open your browser to here:
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/requirements.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/requirements.mustache
index 275787f38cc..5989d62ff72 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/requirements.mustache
@@ -1,8 +1,5 @@
connexion == 1.1.15
python_dateutil == 2.6.0
-{{#supportPython2}}
-typing == 3.5.2.2
-{{/supportPython2}}
setuptools >= 21.0.0
bp2hookutil==3.3.0
plansdk
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache
index d774cfd8dbd..9391d6aafac 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache
@@ -1,5 +1,5 @@
[tox]
-envlist = {{#supportPython2}}py27, {{/supportPython2}}py35
+envlist = py35
[testenv]
deps=-r{toxinidir}/requirements.txt
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/__main__.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/__main__.mustache
index ab6835dac85..f558123c30a 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/__main__.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/__main__.mustache
@@ -1,9 +1,4 @@
-{{#supportPython2}}
-#!/usr/bin/env python
-{{/supportPython2}}
-{{^supportPython2}}
#!/usr/bin/env python3
-{{/supportPython2}}
import connexion
{{#featureCORS}}
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/base_model_.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/base_model_.mustache
index 54517a06d53..888fa989646 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/base_model_.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/base_model_.mustache
@@ -1,15 +1,11 @@
import pprint
import six
-{{^supportPython2}}
import typing
-{{/supportPython2}}
from {{packageName}} import util
-{{^supportPython2}}
T = typing.TypeVar('T')
-{{/supportPython2}}
class Model(object):
@@ -22,7 +18,7 @@ class Model(object):
attribute_map = {}
@classmethod
- def from_dict(cls{{^supportPython2}}: typing.Type[T]{{/supportPython2}}, dikt){{^supportPython2}} -> T{{/supportPython2}}:
+ def from_dict(cls: typing.Type[T], dikt) -> T:
"""Returns the dict as a model"""
return util.deserialize_model(dikt, cls)
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/model.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/model.mustache
index 587589e6001..d9aa9bfd34d 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/model.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/{{packageName}}/models/model.mustache
@@ -27,7 +27,7 @@ class {{classname}}(Model):
{{/-last}}
{{/enumVars}}{{/allowableValues}}
- def __init__(self{{#vars}}, {{name}}{{^supportPython2}}: {{datatype}}{{/supportPython2}}={{{defaultValue}}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501
+ def __init__(self{{#vars}}, {{name}}: {{datatype}}={{{defaultValue}}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501
"""{{classname}} - a model defined in Swagger
{{#vars}}
@@ -52,7 +52,7 @@ class {{classname}}(Model):
{{/vars}}
@classmethod
- def from_dict(cls, dikt){{^supportPython2}} -> '{{classname}}'{{/supportPython2}}:
+ def from_dict(cls, dikt) -> '{{classname}}':
"""Returns the dict as a model
:param dikt: A dict.
@@ -64,7 +64,7 @@ class {{classname}}(Model):
{{/-first}}
@property
- def {{name}}(self){{^supportPython2}} -> {{datatype}}{{/supportPython2}}:
+ def {{name}}(self) -> {{datatype}}:
"""Gets the {{name}} of this {{classname}}.
{{#description}}
@@ -77,7 +77,7 @@ class {{classname}}(Model):
return self._{{name}}
@{{name}}.setter
- def {{name}}(self, {{name}}{{^supportPython2}}: {{datatype}}{{/supportPython2}}):
+ def {{name}}(self, {{name}}: {{datatype}}):
"""Sets the {{name}} of this {{classname}}.
{{#description}}
diff --git a/modules/openapi-generator/src/main/resources/python-flask/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/python-flask/Dockerfile.mustache
index f040d41ad6c..465eff45c58 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/Dockerfile.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/Dockerfile.mustache
@@ -1,31 +1,16 @@
-{{#supportPython2}}
-FROM python:2-alpine
-{{/supportPython2}}
-{{^supportPython2}}
FROM python:3-alpine
-{{/supportPython2}}
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY requirements.txt /usr/src/app/
-{{#supportPython2}}
-RUN pip install --no-cache-dir -r requirements.txt
-{{/supportPython2}}
-{{^supportPython2}}
RUN pip3 install --no-cache-dir -r requirements.txt
-{{/supportPython2}}
COPY . /usr/src/app
EXPOSE {{serverPort}}
-{{#supportPython2}}
-ENTRYPOINT ["python"]
-{{/supportPython2}}
-{{^supportPython2}}
ENTRYPOINT ["python3"]
-{{/supportPython2}}
CMD ["-m", "{{packageName}}"]
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-flask/README.mustache b/modules/openapi-generator/src/main/resources/python-flask/README.mustache
index 3612c2617dc..f36875e4504 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/README.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/README.mustache
@@ -8,25 +8,14 @@ is an example of building a OpenAPI-enabled Flask server.
This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.
## Requirements
-{{#supportPython2}}
-Python 2.7+
-{{/supportPython2}}
-{{^supportPython2}}
Python 3.5.2+
-{{/supportPython2}}
## Usage
To run the server, please execute the following from the root directory:
```
-{{#supportPython2}}
-pip install -r requirements.txt
-python -m {{packageName}}
-{{/supportPython2}}
-{{^supportPython2}}
pip3 install -r requirements.txt
python3 -m {{packageName}}
-{{/supportPython2}}
```
and open your browser to here:
diff --git a/modules/openapi-generator/src/main/resources/python-flask/__main__.mustache b/modules/openapi-generator/src/main/resources/python-flask/__main__.mustache
index b6018a3af05..4dfeb86aeef 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/__main__.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/__main__.mustache
@@ -1,9 +1,4 @@
-{{#supportPython2}}
-#!/usr/bin/env python
-{{/supportPython2}}
-{{^supportPython2}}
#!/usr/bin/env python3
-{{/supportPython2}}
import connexion
{{#featureCORS}}
diff --git a/modules/openapi-generator/src/main/resources/python-flask/base_model_.mustache b/modules/openapi-generator/src/main/resources/python-flask/base_model_.mustache
index e2a33d46b8e..c771c9e58d5 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/base_model_.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/base_model_.mustache
@@ -1,28 +1,24 @@
import pprint
import six
-{{^supportPython2}}
import typing
-{{/supportPython2}}
from {{packageName}} import util
-{{^supportPython2}}
T = typing.TypeVar('T')
-{{/supportPython2}}
-class Model({{#supportPython2}}object{{/supportPython2}}):
+class Model(object):
# openapiTypes: The key is attribute name and the
# value is attribute type.
- openapi_types{{^supportPython2}}: typing.Dict[str, type]{{/supportPython2}} = {}
+ openapi_types: typing.Dict[str, type] = {}
# attributeMap: The key is attribute name and the
# value is json key in definition.
- attribute_map{{^supportPython2}}: typing.Dict[str, str]{{/supportPython2}} = {}
+ attribute_map: typing.Dict[str, str] = {}
@classmethod
- def from_dict(cls{{^supportPython2}}: typing.Type[T]{{/supportPython2}}, dikt){{^supportPython2}} -> T{{/supportPython2}}:
+ def from_dict(cls: typing.Type[T], dikt) -> T:
"""Returns the dict as a model"""
return util.deserialize_model(dikt, cls)
diff --git a/modules/openapi-generator/src/main/resources/python-flask/model.mustache b/modules/openapi-generator/src/main/resources/python-flask/model.mustache
index 3438bccfa59..300938389a1 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/model.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/model.mustache
@@ -62,7 +62,7 @@ class {{classname}}(Model):
{{/vars}}
@classmethod
- def from_dict(cls, dikt){{^supportPython2}} -> '{{classname}}'{{/supportPython2}}:
+ def from_dict(cls, dikt) -> '{{classname}}':
"""Returns the dict as a model
:param dikt: A dict.
diff --git a/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache b/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
index 2d1a20a0190..8161173186d 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
@@ -1,9 +1,6 @@
connexion[swagger-ui] >= 2.6.0; python_version>="3.6"
# 2.3 is the last version that supports python 3.4-3.5
connexion[swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=="3.4"
-{{#supportPython2}}
-connexion[swagger-ui] == 2.4.0; python_version<="2.7"
-{{/supportPython2}}
# connexion requires werkzeug but connexion < 2.4.0 does not install werkzeug
# we must peg werkzeug versions below to fix connexion
# https://github.com/zalando/connexion/pull/1044
@@ -14,12 +11,5 @@ python_dateutil >= 2.6.0
# should support both Python 2 and Python 3
flask-cors >= 3.0.10
{{/featureCORS}}
-{{#supportPython2}}
-typing >= 3.5.2.2
-# For specs with timestamps, pyyaml 5.3 broke connexion's spec parsing in python 2.
-# Connexion uses copy.deepcopy() on the spec, thus hitting this bug:
-# https://github.com/yaml/pyyaml/issues/387
-pyyaml < 5.3; python_version<="2.7"
-{{/supportPython2}}
setuptools >= 21.0.0
-Flask == 1.1.2
+Flask == 2.1.1
diff --git a/modules/openapi-generator/src/main/resources/python-flask/setup.mustache b/modules/openapi-generator/src/main/resources/python-flask/setup.mustache
index 722f43969c3..ec06a7798b2 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/setup.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/setup.mustache
@@ -16,8 +16,7 @@ VERSION = "{{packageVersion}}"
REQUIRES = [
"connexion>=2.0.2",
"swagger-ui-bundle>=0.0.2",
- "python_dateutil>=2.6.0"{{#supportPython2}},
- "typing>=3.5.2.2"{{/supportPython2}}
+ "python_dateutil>=2.6.0"
]
setup(
diff --git a/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache
index 7157c73aa34..1de59f85590 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache
@@ -6,8 +6,8 @@ py>=1.4.31
randomize>=0.13
{{/useNose}}
{{^useNose}}
-pytest~=4.6.7 # needed for python 2.7+3.4
+pytest~=7.1.0
pytest-cov>=2.8.1
-pytest-randomly==1.2.3 # needed for python 2.7+3.4
+pytest-randomly>=1.2.3
{{/useNose}}
-Flask-Testing==0.8.0
+Flask-Testing==0.8.1
diff --git a/modules/openapi-generator/src/main/resources/python-flask/tox.mustache b/modules/openapi-generator/src/main/resources/python-flask/tox.mustache
index d342cd5f573..76e368c2393 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/tox.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/tox.mustache
@@ -1,5 +1,5 @@
[tox]
-envlist = {{#supportPython2}}py27, {{/supportPython2}}py3
+envlist = py3
skipsdist=True
[testenv]
diff --git a/modules/openapi-generator/src/main/resources/python-flask/travis.mustache b/modules/openapi-generator/src/main/resources/python-flask/travis.mustache
index e03b816ecc0..ad71ee5ca08 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/travis.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/travis.mustache
@@ -1,9 +1,6 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
-{{#supportPython2}}
- - "2.7"
-{{/supportPython2}}
- "3.2"
- "3.3"
- "3.4"
diff --git a/pom.xml b/pom.xml
index 6a24e4614af..86be53812d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1131,11 +1131,6 @@
samples/client/petstore/php/OpenAPIClient-php
-
- samples/server/petstore/python-aiohttp
- samples/server/petstore/python-aiohttp-srclayout
- samples/server/petstore/python-fastapi
- samples/server/petstore/python-flask
+ samples/server/petstore/python-aiohttp
+ samples/server/petstore/python-aiohttp-srclayout
+ samples/server/petstore/python-fastapi
+ samples/server/petstore/python-flask
samples/server/petstore/java-camel
samples/server/petstore/java-vertx-web
samples/server/petstore/java-inflector
diff --git a/samples/server/petstore/python-aiohttp-srclayout/Makefile b/samples/server/petstore/python-aiohttp-srclayout/Makefile
index e73e0b9b307..4e8fafc39bf 100644
--- a/samples/server/petstore/python-aiohttp-srclayout/Makefile
+++ b/samples/server/petstore/python-aiohttp-srclayout/Makefile
@@ -12,7 +12,7 @@ clean:
find . -name "__pycache__" -delete
venv:
- python -m venv $(VENV)
+ python3 -m venv $(VENV)
test: clean venv
bash ./test_python3.sh
diff --git a/samples/server/petstore/python-aiohttp-srclayout/requirements.txt b/samples/server/petstore/python-aiohttp-srclayout/requirements.txt
index e0dd796ca9f..70c264978d3 100644
--- a/samples/server/petstore/python-aiohttp-srclayout/requirements.txt
+++ b/samples/server/petstore/python-aiohttp-srclayout/requirements.txt
@@ -5,5 +5,5 @@ connexion[aiohttp,swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=
# we must peg werkzeug versions below to fix connexion
# https://github.com/zalando/connexion/pull/1044
werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
-swagger-ui-bundle == 0.0.6
-aiohttp_jinja2 == 1.2.0
+swagger-ui-bundle == 0.0.9
+aiohttp_jinja2 == 1.5.0
diff --git a/samples/server/petstore/python-aiohttp-srclayout/setup.py b/samples/server/petstore/python-aiohttp-srclayout/setup.py
index 6f62aec4414..5cfff33cdbe 100644
--- a/samples/server/petstore/python-aiohttp-srclayout/setup.py
+++ b/samples/server/petstore/python-aiohttp-srclayout/setup.py
@@ -14,9 +14,9 @@ VERSION = "1.0.0"
# http://pypi.python.org/pypi/setuptools
REQUIRES = [
- "connexion==2.6.0",
- "swagger-ui-bundle==0.0.6",
- "aiohttp_jinja2==1.2.0",
+ "connexion==2.14.1",
+ "swagger-ui-bundle==0.0.9",
+ "aiohttp_jinja2==1.5.0",
]
setup(
diff --git a/samples/server/petstore/python-aiohttp-srclayout/test-requirements.txt b/samples/server/petstore/python-aiohttp-srclayout/test-requirements.txt
index 31b28baaf28..bb7df90d4b2 100644
--- a/samples/server/petstore/python-aiohttp-srclayout/test-requirements.txt
+++ b/samples/server/petstore/python-aiohttp-srclayout/test-requirements.txt
@@ -1,4 +1,4 @@
-pytest~=4.6.7 # needed for python 2.7+3.4
+pytest~=7.1.0
pytest-cov>=2.8.1
-pytest-randomly==1.2.3 # needed for python 2.7+3.4
+pytest-randomly>=1.2.3
pytest-aiohttp>=0.3.0
diff --git a/samples/server/petstore/python-aiohttp/Makefile b/samples/server/petstore/python-aiohttp/Makefile
index e73e0b9b307..4e8fafc39bf 100644
--- a/samples/server/petstore/python-aiohttp/Makefile
+++ b/samples/server/petstore/python-aiohttp/Makefile
@@ -12,7 +12,7 @@ clean:
find . -name "__pycache__" -delete
venv:
- python -m venv $(VENV)
+ python3 -m venv $(VENV)
test: clean venv
bash ./test_python3.sh
diff --git a/samples/server/petstore/python-aiohttp/requirements.txt b/samples/server/petstore/python-aiohttp/requirements.txt
index e0dd796ca9f..70c264978d3 100644
--- a/samples/server/petstore/python-aiohttp/requirements.txt
+++ b/samples/server/petstore/python-aiohttp/requirements.txt
@@ -5,5 +5,5 @@ connexion[aiohttp,swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=
# we must peg werkzeug versions below to fix connexion
# https://github.com/zalando/connexion/pull/1044
werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
-swagger-ui-bundle == 0.0.6
-aiohttp_jinja2 == 1.2.0
+swagger-ui-bundle == 0.0.9
+aiohttp_jinja2 == 1.5.0
diff --git a/samples/server/petstore/python-aiohttp/setup.py b/samples/server/petstore/python-aiohttp/setup.py
index b6a25d8966e..d464315706a 100644
--- a/samples/server/petstore/python-aiohttp/setup.py
+++ b/samples/server/petstore/python-aiohttp/setup.py
@@ -14,9 +14,9 @@ VERSION = "1.0.0"
# http://pypi.python.org/pypi/setuptools
REQUIRES = [
- "connexion==2.6.0",
- "swagger-ui-bundle==0.0.6",
- "aiohttp_jinja2==1.2.0",
+ "connexion==2.14.1",
+ "swagger-ui-bundle==0.0.9",
+ "aiohttp_jinja2==1.5.0",
]
setup(
diff --git a/samples/server/petstore/python-aiohttp/test-requirements.txt b/samples/server/petstore/python-aiohttp/test-requirements.txt
index 31b28baaf28..bb7df90d4b2 100644
--- a/samples/server/petstore/python-aiohttp/test-requirements.txt
+++ b/samples/server/petstore/python-aiohttp/test-requirements.txt
@@ -1,4 +1,4 @@
-pytest~=4.6.7 # needed for python 2.7+3.4
+pytest~=7.1.0
pytest-cov>=2.8.1
-pytest-randomly==1.2.3 # needed for python 2.7+3.4
+pytest-randomly>=1.2.3
pytest-aiohttp>=0.3.0
diff --git a/samples/server/petstore/python-aiohttp/tests/test_pet_controller.py b/samples/server/petstore/python-aiohttp/tests/test_pet_controller.py
index 5f6384a34f6..de3d3eeb82e 100644
--- a/samples/server/petstore/python-aiohttp/tests/test_pet_controller.py
+++ b/samples/server/petstore/python-aiohttp/tests/test_pet_controller.py
@@ -9,7 +9,7 @@ from openapi_server.models.api_response import ApiResponse
from openapi_server.models.pet import Pet
-@pytest.mark.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760")
+@pytest.mark.skip("Connexion does not support multiple consumes. See https://github.com/zalando/connexion/pull/760")
async def test_add_pet(client):
"""Test case for add_pet
@@ -67,7 +67,7 @@ async def test_find_pets_by_status(client):
Finds Pets by status
"""
- params = [('status', 'available')]
+ params = [('status', ['available'])]
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer special-key',
@@ -86,7 +86,7 @@ async def test_find_pets_by_tags(client):
Finds Pets by tags
"""
- params = [('tags', 'tags_example')]
+ params = [('tags', ['tags_example'])]
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer special-key',
@@ -117,7 +117,7 @@ async def test_get_pet_by_id(client):
assert response.status == 200, 'Response body is : ' + (await response.read()).decode('utf-8')
-@pytest.mark.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760")
+@pytest.mark.skip("Connexion does not support multiple consumes. See https://github.com/zalando/connexion/pull/760")
async def test_update_pet(client):
"""Test case for update_pet
@@ -189,7 +189,7 @@ async def test_upload_file(client):
}
data = FormData()
data.add_field('additional_metadata', 'additional_metadata_example')
- data.add_field('file', (BytesIO(b'some file data'), 'file.txt'))
+ data.add_field('file', '/path/to/file')
response = await client.request(
method='POST',
path='/v2/pet/{pet_id}/uploadImage'.format(pet_id=56),
diff --git a/samples/server/petstore/python-aiohttp/tests/test_store_controller.py b/samples/server/petstore/python-aiohttp/tests/test_store_controller.py
index 9d376a5f7a5..9625a8b35e6 100644
--- a/samples/server/petstore/python-aiohttp/tests/test_store_controller.py
+++ b/samples/server/petstore/python-aiohttp/tests/test_store_controller.py
@@ -49,7 +49,7 @@ async def test_get_order_by_id(client):
}
response = await client.request(
method='GET',
- path='/v2/store/order/{order_id}'.format(order_id=5),
+ path='/v2/store/order/{order_id}'.format(order_id=1),
headers=headers,
)
assert response.status == 200, 'Response body is : ' + (await response.read()).decode('utf-8')
@@ -61,7 +61,7 @@ async def test_place_order(client):
Place an order for a pet
"""
- body = {}
+ body = openapi_server.Order()
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
diff --git a/samples/server/petstore/python-aiohttp/tests/test_user_controller.py b/samples/server/petstore/python-aiohttp/tests/test_user_controller.py
index 6564329315e..c695e4f0c95 100644
--- a/samples/server/petstore/python-aiohttp/tests/test_user_controller.py
+++ b/samples/server/petstore/python-aiohttp/tests/test_user_controller.py
@@ -13,7 +13,7 @@ async def test_create_user(client):
Create user
"""
- body = {}
+ body = openapi_server.User()
headers = {
'Content-Type': 'application/json',
}
@@ -32,7 +32,7 @@ async def test_create_users_with_array_input(client):
Creates list of users with given input array
"""
- body = [{}]
+ body = [openapi_server.User()]
headers = {
'Content-Type': 'application/json',
}
@@ -51,7 +51,7 @@ async def test_create_users_with_list_input(client):
Creates list of users with given input array
"""
- body = [{}]
+ body = [openapi_server.User()]
headers = {
'Content-Type': 'application/json',
}
@@ -135,7 +135,7 @@ async def test_update_user(client):
Updated user
"""
- body = {}
+ body = openapi_server.User()
headers = {
'Content-Type': 'application/json',
}
diff --git a/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_pet_controller.py b/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_pet_controller.py
index 34b8e534e66..70ce6ad26ab 100644
--- a/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_pet_controller.py
+++ b/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_pet_controller.py
@@ -61,7 +61,7 @@ class TestPetController(BaseTestCase):
Finds Pets by status
"""
- query_string = [('status', 'available')]
+ query_string = [('status', ['available'])]
response = self.client.open(
'/v2/pet/findByStatus',
method='GET',
@@ -74,7 +74,7 @@ class TestPetController(BaseTestCase):
Finds Pets by tags
"""
- query_string = [('tags', 'tags_example')]
+ query_string = [('tags', ['tags_example'])]
response = self.client.open(
'/v2/pet/findByTags',
method='GET',
@@ -144,7 +144,7 @@ class TestPetController(BaseTestCase):
uploads an image
"""
data = dict(additional_metadata='additional_metadata_example',
- file=(BytesIO(b'some file data'), 'file.txt'))
+ file='/path/to/file')
response = self.client.open(
'/v2/pet/{pet_id}/uploadImage'.format(pet_id=56),
method='POST',
diff --git a/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_store_controller.py b/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_store_controller.py
index 3695ff4a3b3..57bd3fa8f86 100644
--- a/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_store_controller.py
+++ b/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_store_controller.py
@@ -40,7 +40,7 @@ class TestStoreController(BaseTestCase):
Find purchase order by ID
"""
response = self.client.open(
- '/v2/store/order/{order_id}'.format(order_id=5),
+ '/v2/store/order/{order_id}'.format(order_id=1),
method='GET')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
@@ -50,7 +50,7 @@ class TestStoreController(BaseTestCase):
Place an order for a pet
"""
- body = {}
+ body = openapi_server.Order()
response = self.client.open(
'/v2/store/order',
method='POST',
diff --git a/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_user_controller.py b/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_user_controller.py
index 1ef108621bd..e96791b1cc0 100644
--- a/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_user_controller.py
+++ b/samples/server/petstore/python-blueplanet/app/openapi_server/test/test_user_controller.py
@@ -17,7 +17,7 @@ class TestUserController(BaseTestCase):
Create user
"""
- body = {}
+ body = openapi_server.User()
response = self.client.open(
'/v2/user',
method='POST',
@@ -31,7 +31,7 @@ class TestUserController(BaseTestCase):
Creates list of users with given input array
"""
- body = []
+ body = [openapi_server.User()]
response = self.client.open(
'/v2/user/createWithArray',
method='POST',
@@ -45,7 +45,7 @@ class TestUserController(BaseTestCase):
Creates list of users with given input array
"""
- body = []
+ body = [openapi_server.User()]
response = self.client.open(
'/v2/user/createWithList',
method='POST',
@@ -106,7 +106,7 @@ class TestUserController(BaseTestCase):
Updated user
"""
- body = {}
+ body = openapi_server.User()
response = self.client.open(
'/v2/user/{username}'.format(username='username_example'),
method='PUT',
diff --git a/samples/server/petstore/python-flask/openapi_server/models/base_model_.py b/samples/server/petstore/python-flask/openapi_server/models/base_model_.py
index 961abbf3223..916e582ec27 100644
--- a/samples/server/petstore/python-flask/openapi_server/models/base_model_.py
+++ b/samples/server/petstore/python-flask/openapi_server/models/base_model_.py
@@ -8,7 +8,7 @@ from openapi_server import util
T = typing.TypeVar('T')
-class Model():
+class Model(object):
# openapiTypes: The key is attribute name and the
# value is attribute type.
openapi_types: typing.Dict[str, type] = {}
diff --git a/samples/server/petstore/python-flask/openapi_server/test/test_pet_controller.py b/samples/server/petstore/python-flask/openapi_server/test/test_pet_controller.py
index f29ac97214b..d1eb1d32668 100644
--- a/samples/server/petstore/python-flask/openapi_server/test/test_pet_controller.py
+++ b/samples/server/petstore/python-flask/openapi_server/test/test_pet_controller.py
@@ -14,7 +14,7 @@ from openapi_server.test import BaseTestCase
class TestPetController(BaseTestCase):
"""PetController integration test stubs"""
- @unittest.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760")
+ @unittest.skip("Connexion does not support multiple consumes. See https://github.com/zalando/connexion/pull/760")
def test_add_pet(self):
"""Test case for add_pet
@@ -89,7 +89,7 @@ class TestPetController(BaseTestCase):
Finds Pets by tags
"""
- query_string = [('tags', 'tags_example')]
+ query_string = [('tags', ['tags_example'])]
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer special-key',
@@ -118,7 +118,7 @@ class TestPetController(BaseTestCase):
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
- @unittest.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760")
+ @unittest.skip("Connexion does not support multiple consumes. See https://github.com/zalando/connexion/pull/760")
def test_update_pet(self):
"""Test case for update_pet
@@ -187,7 +187,7 @@ class TestPetController(BaseTestCase):
'Authorization': 'Bearer special-key',
}
data = dict(additional_metadata='additional_metadata_example',
- file=(BytesIO(b'some file data'), 'file.txt'))
+ file='/path/to/file')
response = self.client.open(
'/v2/pet/{pet_id}/uploadImage'.format(pet_id=56),
method='POST',
diff --git a/samples/server/petstore/python-flask/openapi_server/test/test_store_controller.py b/samples/server/petstore/python-flask/openapi_server/test/test_store_controller.py
index e2d0c7ddd37..43867b1d98e 100644
--- a/samples/server/petstore/python-flask/openapi_server/test/test_store_controller.py
+++ b/samples/server/petstore/python-flask/openapi_server/test/test_store_controller.py
@@ -52,7 +52,7 @@ class TestStoreController(BaseTestCase):
'Accept': 'application/json',
}
response = self.client.open(
- '/v2/store/order/{order_id}'.format(order_id=5),
+ '/v2/store/order/{order_id}'.format(order_id=1),
method='GET',
headers=headers)
self.assert200(response,
@@ -64,7 +64,7 @@ class TestStoreController(BaseTestCase):
Place an order for a pet
"""
- body = {}
+ body = openapi_server.Order()
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
diff --git a/samples/server/petstore/python-flask/openapi_server/test/test_user_controller.py b/samples/server/petstore/python-flask/openapi_server/test/test_user_controller.py
index 172ff22d13d..010a72b0306 100644
--- a/samples/server/petstore/python-flask/openapi_server/test/test_user_controller.py
+++ b/samples/server/petstore/python-flask/openapi_server/test/test_user_controller.py
@@ -19,7 +19,7 @@ class TestUserController(BaseTestCase):
Create user
"""
- body = {}
+ body = openapi_server.User()
headers = {
'Content-Type': 'application/json',
}
@@ -38,7 +38,7 @@ class TestUserController(BaseTestCase):
Creates list of users with given input array
"""
- body = [{}]
+ body = [openapi_server.User()]
headers = {
'Content-Type': 'application/json',
}
@@ -57,7 +57,7 @@ class TestUserController(BaseTestCase):
Creates list of users with given input array
"""
- body = [{}]
+ body = [openapi_server.User()]
headers = {
'Content-Type': 'application/json',
}
@@ -137,7 +137,7 @@ class TestUserController(BaseTestCase):
Updated user
"""
- body = {}
+ body = openapi_server.User()
headers = {
'Content-Type': 'application/json',
}
diff --git a/samples/server/petstore/python-flask/requirements.txt b/samples/server/petstore/python-flask/requirements.txt
index 70e1f0c5540..be4c8a3a02c 100644
--- a/samples/server/petstore/python-flask/requirements.txt
+++ b/samples/server/petstore/python-flask/requirements.txt
@@ -8,4 +8,4 @@ werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0
setuptools >= 21.0.0
-Flask == 1.1.2
+Flask == 2.1.1
diff --git a/samples/server/petstore/python-flask/test-requirements.txt b/samples/server/petstore/python-flask/test-requirements.txt
index 0970f28c7c5..58f51d6a002 100644
--- a/samples/server/petstore/python-flask/test-requirements.txt
+++ b/samples/server/petstore/python-flask/test-requirements.txt
@@ -1,4 +1,4 @@
-pytest~=4.6.7 # needed for python 2.7+3.4
+pytest~=7.1.0
pytest-cov>=2.8.1
-pytest-randomly==1.2.3 # needed for python 2.7+3.4
-Flask-Testing==0.8.0
+pytest-randomly>=1.2.3
+Flask-Testing==0.8.1