From 8137302027f2adab5cc60ee21b3cc521659b03f6 Mon Sep 17 00:00:00 2001 From: LoveIsGrief <loveisgrief@tuta.io> Date: Sun, 16 Feb 2020 22:36:55 +0100 Subject: [PATCH 1/2] python: Add gitlab-ci.mustache It does the same stuff as in the .travis.yml but just for Gitlab CI #5340 - Python .gitlab-ci.yml --- .../languages/PythonClientCodegen.java | 1 + .../main/resources/python/gitlab-ci.mustache | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 99a972c2ede..f8ce69ed964 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -266,6 +266,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); + supportingFiles.add(new SupportingFile("gitlab-ci.mustache", "", ".gitlab-ci.yml")); supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py")); } supportingFiles.add(new SupportingFile("configuration.mustache", packagePath(), "configuration.py")); diff --git a/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache b/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine -- GitLab From 4830b83558e0f8ffcb08552a6c0fbfbbadbd7089 Mon Sep 17 00:00:00 2001 From: LoveIsGrief <loveisgrief@tuta.io> Date: Sun, 16 Feb 2020 23:10:08 +0100 Subject: [PATCH 2/2] python: Run all scripts in bin find bin/ -type f -name 'python*.sh' -exec {} \; Had to update all samples --- .../petstore/python-asyncio/.gitlab-ci.yml | 33 +++++++++++++++++++ .../python-experimental/.gitlab-ci.yml | 33 +++++++++++++++++++ .../petstore/python-tornado/.gitlab-ci.yml | 33 +++++++++++++++++++ samples/client/petstore/python/.gitlab-ci.yml | 33 +++++++++++++++++++ .../python-experimental/.gitlab-ci.yml | 33 +++++++++++++++++++ .../client/petstore/python/.gitlab-ci.yml | 33 +++++++++++++++++++ .../.openapi-generator/VERSION | 2 +- .../controllers/pet_controller.py | 4 +-- .../openapi_server/openapi/openapi.yaml | 18 ++++++++++ .../test/test_pet_controller.py | 2 ++ .../python-flask/.openapi-generator/VERSION | 2 +- .../controllers/pet_controller.py | 4 +-- .../openapi_server/openapi/openapi.yaml | 18 ++++++++++ .../test/test_pet_controller.py | 2 ++ 14 files changed, 244 insertions(+), 6 deletions(-) create mode 100644 samples/client/petstore/python-asyncio/.gitlab-ci.yml create mode 100644 samples/client/petstore/python-experimental/.gitlab-ci.yml create mode 100644 samples/client/petstore/python-tornado/.gitlab-ci.yml create mode 100644 samples/client/petstore/python/.gitlab-ci.yml create mode 100644 samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml create mode 100644 samples/openapi3/client/petstore/python/.gitlab-ci.yml diff --git a/samples/client/petstore/python-asyncio/.gitlab-ci.yml b/samples/client/petstore/python-asyncio/.gitlab-ci.yml new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/samples/client/petstore/python-asyncio/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/samples/client/petstore/python-experimental/.gitlab-ci.yml b/samples/client/petstore/python-experimental/.gitlab-ci.yml new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/samples/client/petstore/python-experimental/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/samples/client/petstore/python-tornado/.gitlab-ci.yml b/samples/client/petstore/python-tornado/.gitlab-ci.yml new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/samples/client/petstore/python-tornado/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/samples/client/petstore/python/.gitlab-ci.yml b/samples/client/petstore/python/.gitlab-ci.yml new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/samples/client/petstore/python/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml b/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/samples/openapi3/client/petstore/python/.gitlab-ci.yml b/samples/openapi3/client/petstore/python/.gitlab-ci.yml new file mode 100644 index 00000000000..28046fefa0c --- /dev/null +++ b/samples/openapi3/client/petstore/python/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install nose + - nosetests + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION b/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION index 58592f031f6..bfbf77eb7fa 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/python-flask-python2/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.3-SNAPSHOT \ No newline at end of file +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py b/samples/openapi3/server/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py index 125820f0054..9376ab94244 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py +++ b/samples/openapi3/server/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py @@ -14,7 +14,7 @@ def add_pet(pet): # noqa: E501 :param pet: Pet object that needs to be added to the store :type pet: dict | bytes - :rtype: None + :rtype: Pet """ if connexion.request.is_json: pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 @@ -83,7 +83,7 @@ def update_pet(pet): # noqa: E501 :param pet: Pet object that needs to be added to the store :type pet: dict | bytes - :rtype: None + :rtype: Pet """ if connexion.request.is_json: pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 diff --git a/samples/openapi3/server/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml b/samples/openapi3/server/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml index 922e0b4af69..d98eee5eb1b 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml +++ b/samples/openapi3/server/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml @@ -26,6 +26,15 @@ paths: requestBody: $ref: '#/components/requestBodies/Pet' responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation "405": description: Invalid input security: @@ -41,6 +50,15 @@ paths: requestBody: $ref: '#/components/requestBodies/Pet' responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation "400": description: Invalid ID supplied "404": diff --git a/samples/openapi3/server/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py b/samples/openapi3/server/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py index 230ac4a4b60..0d4565a3678 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py +++ b/samples/openapi3/server/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py @@ -38,6 +38,7 @@ class TestPetController(BaseTestCase): "status" : "available" } headers = { + 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer special-key', } @@ -142,6 +143,7 @@ class TestPetController(BaseTestCase): "status" : "available" } headers = { + 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer special-key', } diff --git a/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION b/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION index 58592f031f6..bfbf77eb7fa 100644 --- a/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/python-flask/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.3-SNAPSHOT \ No newline at end of file +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask/openapi_server/controllers/pet_controller.py b/samples/openapi3/server/petstore/python-flask/openapi_server/controllers/pet_controller.py index 125820f0054..9376ab94244 100644 --- a/samples/openapi3/server/petstore/python-flask/openapi_server/controllers/pet_controller.py +++ b/samples/openapi3/server/petstore/python-flask/openapi_server/controllers/pet_controller.py @@ -14,7 +14,7 @@ def add_pet(pet): # noqa: E501 :param pet: Pet object that needs to be added to the store :type pet: dict | bytes - :rtype: None + :rtype: Pet """ if connexion.request.is_json: pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 @@ -83,7 +83,7 @@ def update_pet(pet): # noqa: E501 :param pet: Pet object that needs to be added to the store :type pet: dict | bytes - :rtype: None + :rtype: Pet """ if connexion.request.is_json: pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 diff --git a/samples/openapi3/server/petstore/python-flask/openapi_server/openapi/openapi.yaml b/samples/openapi3/server/petstore/python-flask/openapi_server/openapi/openapi.yaml index 922e0b4af69..d98eee5eb1b 100644 --- a/samples/openapi3/server/petstore/python-flask/openapi_server/openapi/openapi.yaml +++ b/samples/openapi3/server/petstore/python-flask/openapi_server/openapi/openapi.yaml @@ -26,6 +26,15 @@ paths: requestBody: $ref: '#/components/requestBodies/Pet' responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation "405": description: Invalid input security: @@ -41,6 +50,15 @@ paths: requestBody: $ref: '#/components/requestBodies/Pet' responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation "400": description: Invalid ID supplied "404": diff --git a/samples/openapi3/server/petstore/python-flask/openapi_server/test/test_pet_controller.py b/samples/openapi3/server/petstore/python-flask/openapi_server/test/test_pet_controller.py index c756d7bb2ca..50a1e25cbb8 100644 --- a/samples/openapi3/server/petstore/python-flask/openapi_server/test/test_pet_controller.py +++ b/samples/openapi3/server/petstore/python-flask/openapi_server/test/test_pet_controller.py @@ -38,6 +38,7 @@ class TestPetController(BaseTestCase): "status" : "available" } headers = { + 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer special-key', } @@ -142,6 +143,7 @@ class TestPetController(BaseTestCase): "status" : "available" } headers = { + 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer special-key', } -- GitLab