From 87d91d3c8922b18490abe0fbba4a1b001bb73756 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 12 Sep 2023 15:35:26 +0800 Subject: [PATCH 1/2] update github workflow, use debug instead of warning --- .../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 - 15 files changed, 39 insertions(+), 11 deletions(-) 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 12dad3e640c9..c571b09f6bb7 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 @@ private String toExampleValueRecursive(Schema schema, List includedSchem } 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 void setParameterExampleValue(CodegenParameter p) { // 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 a3aae3f5bf68..868124c0bc55 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 0bb48fd6d8c8..8a6130a2f7b9 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 bd4fe39d883b..f204cda05c52 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 ca8eb277004b..3a0d0b939a1e 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 bcc6ea7b19bd..f128ba25e3dd 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 00e696fca263..29da7211174d 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 6752d090a969..fed030f265ed 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 1d94e3846964..b4719756536b 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 6833ad6202a4..bd242be2a0f4 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 8fc452fe6edd..3a0d0b939a1e 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 6752d090a969..fed030f265ed 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 1d94e3846964..b4719756536b 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 258c179c10b2..e807d94fe0a2 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 8fc452fe6edd..3a0d0b939a1e 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 From e9f22fe8ec64ffddeb4113da0ed134f79c56060b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 12 Sep 2023 15:51:21 +0800 Subject: [PATCH 2/2] use debug instead of warn --- .../main/java/org/openapitools/codegen/DefaultCodegen.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 624729f3cdeb..cfe1b493216d 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 @@ protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map