From a5f79a7bdccb59ed9881930d4f925da4dbf91168 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 12 Sep 2023 16:55:53 +0800 Subject: [PATCH] [python] Update github workflow, use debug instead of warning (#16565) * update github workflow, use debug instead of warning * use debug instead of warn --- .../java/org/openapitools/codegen/DefaultCodegen.java | 4 ++-- .../codegen/languages/AbstractPythonCodegen.java | 4 ++-- .../src/main/resources/python/github-workflow.mustache | 1 + .../src/main/resources/python/gitlab-ci.mustache | 8 +++++++- .../src/main/resources/python/requirements.mustache | 3 +++ .../src/main/resources/python/test-requirements.mustache | 3 --- .../client/echo_api/python/.github/workflows/python.yml | 1 + samples/client/echo_api/python/.gitlab-ci.yml | 8 +++++++- .../petstore/python-aiohttp/.github/workflows/python.yml | 1 + .../client/petstore/python-aiohttp/.gitlab-ci.yml | 8 +++++++- .../client/petstore/python-aiohttp/requirements.txt | 1 + .../client/petstore/python-aiohttp/test-requirements.txt | 1 - .../client/petstore/python/.github/workflows/python.yml | 1 + samples/openapi3/client/petstore/python/.gitlab-ci.yml | 8 +++++++- samples/openapi3/client/petstore/python/requirements.txt | 1 + .../openapi3/client/petstore/python/test-requirements.txt | 1 - 16 files changed, 41 insertions(+), 13 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 624729f3cde..cfe1b493216 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2747,14 +2747,14 @@ public class DefaultCodegen implements CodegenConfig { if (composed.getAnyOf() != null) { if (m.anyOf.contains(languageType)) { - LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); + LOGGER.debug("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); } else { m.anyOf.add(languageType); } } else if (composed.getOneOf() != null) { if (m.oneOf.contains(languageType)) { - LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); + LOGGER.debug("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); } else { m.oneOf.add(languageType); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index 12dad3e640c..c571b09f6bb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -529,7 +529,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co } example += ")"; } else { - LOGGER.warn("Type {} not handled properly in toExampleValue", schema.getType()); + LOGGER.debug("Type {} not handled properly in toExampleValue", schema.getType()); } if (ModelUtils.isStringSchema(schema)) { @@ -591,7 +591,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co // type is a model class, e.g. User example = this.packageName + "." + type + "()"; } else { - LOGGER.warn("Type {} not handled properly in setParameterExampleValue", type); + LOGGER.debug("Type {} not handled properly in setParameterExampleValue", type); } if (example == null) { diff --git a/modules/openapi-generator/src/main/resources/python/github-workflow.mustache b/modules/openapi-generator/src/main/resources/python/github-workflow.mustache index a3aae3f5bf6..868124c0bc5 100644 --- a/modules/openapi-generator/src/main/resources/python/github-workflow.mustache +++ b/modules/openapi-generator/src/main/resources/python/github-workflow.mustache @@ -27,6 +27,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache b/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache index 0bb48fd6d8c..8a6130a2f7b 100644 --- a/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache +++ b/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache @@ -22,4 +22,10 @@ pytest-3.8: image: python:3.8-alpine pytest-3.9: extends: .pytest - image: python:3.9-alpine \ No newline at end of file + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/modules/openapi-generator/src/main/resources/python/requirements.mustache b/modules/openapi-generator/src/main/resources/python/requirements.mustache index bd4fe39d883..f204cda05c5 100644 --- a/modules/openapi-generator/src/main/resources/python/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/requirements.mustache @@ -6,3 +6,6 @@ aenum >= 3.1.11 {{#asyncio}} aiohttp >= 3.0.0 {{/asyncio}} +{{#hasHttpSignatureMethods}} +pycryptodome >= 3.9.0 +{{/hasHttpSignatureMethods}} diff --git a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache index ca8eb277004..3a0d0b939a1 100644 --- a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache @@ -1,6 +1,3 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 -{{#hasHttpSignatureMethods}} -pycryptodome>=3.9.0 -{{/hasHttpSignatureMethods}} \ No newline at end of file diff --git a/samples/client/echo_api/python/.github/workflows/python.yml b/samples/client/echo_api/python/.github/workflows/python.yml index bcc6ea7b19b..f128ba25e3d 100644 --- a/samples/client/echo_api/python/.github/workflows/python.yml +++ b/samples/client/echo_api/python/.github/workflows/python.yml @@ -26,6 +26,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/samples/client/echo_api/python/.gitlab-ci.yml b/samples/client/echo_api/python/.gitlab-ci.yml index 00e696fca26..29da7211174 100644 --- a/samples/client/echo_api/python/.gitlab-ci.yml +++ b/samples/client/echo_api/python/.gitlab-ci.yml @@ -22,4 +22,10 @@ pytest-3.8: image: python:3.8-alpine pytest-3.9: extends: .pytest - image: python:3.9-alpine \ No newline at end of file + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/samples/openapi3/client/petstore/python-aiohttp/.github/workflows/python.yml b/samples/openapi3/client/petstore/python-aiohttp/.github/workflows/python.yml index 6752d090a96..fed030f265e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.github/workflows/python.yml +++ b/samples/openapi3/client/petstore/python-aiohttp/.github/workflows/python.yml @@ -26,6 +26,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/samples/openapi3/client/petstore/python-aiohttp/.gitlab-ci.yml b/samples/openapi3/client/petstore/python-aiohttp/.gitlab-ci.yml index 1d94e384696..b4719756536 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.gitlab-ci.yml +++ b/samples/openapi3/client/petstore/python-aiohttp/.gitlab-ci.yml @@ -22,4 +22,10 @@ pytest-3.8: image: python:3.8-alpine pytest-3.9: extends: .pytest - image: python:3.9-alpine \ No newline at end of file + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt index 6833ad6202a..bd242be2a0f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt @@ -4,3 +4,4 @@ urllib3 >= 1.25.3, < 2.1.0 pydantic >= 1.10.5, < 2 aenum >= 3.1.11 aiohttp >= 3.0.0 +pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt index 8fc452fe6ed..3a0d0b939a1 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt @@ -1,4 +1,3 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 -pycryptodome>=3.9.0 diff --git a/samples/openapi3/client/petstore/python/.github/workflows/python.yml b/samples/openapi3/client/petstore/python/.github/workflows/python.yml index 6752d090a96..fed030f265e 100644 --- a/samples/openapi3/client/petstore/python/.github/workflows/python.yml +++ b/samples/openapi3/client/petstore/python/.github/workflows/python.yml @@ -26,6 +26,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/samples/openapi3/client/petstore/python/.gitlab-ci.yml b/samples/openapi3/client/petstore/python/.gitlab-ci.yml index 1d94e384696..b4719756536 100755 --- a/samples/openapi3/client/petstore/python/.gitlab-ci.yml +++ b/samples/openapi3/client/petstore/python/.gitlab-ci.yml @@ -22,4 +22,10 @@ pytest-3.8: image: python:3.8-alpine pytest-3.9: extends: .pytest - image: python:3.9-alpine \ No newline at end of file + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/samples/openapi3/client/petstore/python/requirements.txt b/samples/openapi3/client/petstore/python/requirements.txt index 258c179c10b..e807d94fe0a 100755 --- a/samples/openapi3/client/petstore/python/requirements.txt +++ b/samples/openapi3/client/petstore/python/requirements.txt @@ -3,3 +3,4 @@ setuptools >= 21.0.0 urllib3 >= 1.25.3, < 2.1.0 pydantic >= 1.10.5, < 2 aenum >= 3.1.11 +pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python/test-requirements.txt b/samples/openapi3/client/petstore/python/test-requirements.txt index 8fc452fe6ed..3a0d0b939a1 100755 --- a/samples/openapi3/client/petstore/python/test-requirements.txt +++ b/samples/openapi3/client/petstore/python/test-requirements.txt @@ -1,4 +1,3 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 -pycryptodome>=3.9.0