From 4e26cb5d830b372cb1c2cf4b4051681d5919f7ff Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 18 Jan 2024 00:52:17 +0900 Subject: [PATCH 1/5] =?UTF-8?q?openapi-generator=E3=81=AB=E5=90=88?= =?UTF-8?q?=E3=82=8F=E3=81=9B=E3=81=A6openapi=E3=81=AE=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E4=B8=8B=E3=81=92=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.py | 1 + 1 file changed, 1 insertion(+) diff --git a/run.py b/run.py index 7041028cb..27c03b7c0 100644 --- a/run.py +++ b/run.py @@ -1358,6 +1358,7 @@ def custom_openapi(): openapi_schema = get_openapi( title=app.title, version=app.version, + openapi_version="3.0.0", # openapi-generatorがデフォルトの3.1.0に未対応なため description=app.description, routes=app.routes, tags=app.openapi_tags, From 8774afc9d26c75d1a575894f845995035a64681c Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 18 Jan 2024 00:59:57 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E3=81=BE=E3=81=A0=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.py b/run.py index 27c03b7c0..58fa13d85 100644 --- a/run.py +++ b/run.py @@ -1334,7 +1334,7 @@ def setting_get(request: Request) -> Response: dependencies=[Depends(check_disabled_mutable_api)], ) def setting_post( - cors_policy_mode: CorsPolicyMode = Form(), # noqa + cors_policy_mode: str = Form(), # noqa # FIXME: CorsPolicyModeにするとopenapi-generatorがうまく行かない allow_origin: str | None = Form(default=None), # noqa ) -> Response: """ From 621b58be45c13d7b76cb19e7ebe957e95da7588c Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 18 Jan 2024 01:15:37 +0900 Subject: [PATCH 3/5] CorsPolicyMode --- run.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 58fa13d85..ba0c1fae2 100644 --- a/run.py +++ b/run.py @@ -23,7 +23,7 @@ from fastapi.openapi.utils import get_openapi from fastapi.responses import JSONResponse from fastapi.templating import Jinja2Templates -from pydantic import ValidationError +from pydantic import ValidationError, schema_json_of from starlette.background import BackgroundTask from starlette.middleware.errors import ServerErrorMiddleware from starlette.responses import FileResponse @@ -1334,7 +1334,7 @@ def setting_get(request: Request) -> Response: dependencies=[Depends(check_disabled_mutable_api)], ) def setting_post( - cors_policy_mode: str = Form(), # noqa # FIXME: CorsPolicyModeにするとopenapi-generatorがうまく行かない + cors_policy_mode: CorsPolicyMode = Form(), # noqa allow_origin: str | None = Form(default=None), # noqa ) -> Response: """ @@ -1367,6 +1367,9 @@ def custom_openapi(): contact=app.contact, license_info=app.license_info, ) + openapi_schema["components"]["schemas"]["CorsPolicyMode"] = schema_json_of( + CorsPolicyMode + ) openapi_schema["components"]["schemas"][ "VvlibManifest" ] = VvlibManifest.schema() From aed0dd1b90c73d047e04c5b527fff300391ac3de Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 18 Jan 2024 01:34:55 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=81=93=E3=81=86=E3=81=98=E3=82=83?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=81=A8=E3=81=A0=E3=82=81=E3=81=A0=E3=81=A3?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/run.py b/run.py index ba0c1fae2..ebbfadf73 100644 --- a/run.py +++ b/run.py @@ -23,7 +23,7 @@ from fastapi.openapi.utils import get_openapi from fastapi.responses import JSONResponse from fastapi.templating import Jinja2Templates -from pydantic import ValidationError, schema_json_of +from pydantic import ValidationError from starlette.background import BackgroundTask from starlette.middleware.errors import ServerErrorMiddleware from starlette.responses import FileResponse @@ -1334,7 +1334,7 @@ def setting_get(request: Request) -> Response: dependencies=[Depends(check_disabled_mutable_api)], ) def setting_post( - cors_policy_mode: CorsPolicyMode = Form(), # noqa + cors_policy_mode: str = Form(), # noqa # FIXME: CorsPolicyModeにするとopenapi-generatorがエラーになる allow_origin: str | None = Form(default=None), # noqa ) -> Response: """ @@ -1367,9 +1367,6 @@ def custom_openapi(): contact=app.contact, license_info=app.license_info, ) - openapi_schema["components"]["schemas"]["CorsPolicyMode"] = schema_json_of( - CorsPolicyMode - ) openapi_schema["components"]["schemas"][ "VvlibManifest" ] = VvlibManifest.schema() From cca4077bb80f3ffa3a43915134768b269f389c55 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 18 Jan 2024 01:37:34 +0900 Subject: [PATCH 5/5] =?UTF-8?q?openapi-generator=E3=81=8C=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=99=E3=82=8B=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.py b/run.py index ebbfadf73..55b4a05f9 100644 --- a/run.py +++ b/run.py @@ -1358,7 +1358,7 @@ def custom_openapi(): openapi_schema = get_openapi( title=app.title, version=app.version, - openapi_version="3.0.0", # openapi-generatorがデフォルトの3.1.0に未対応なため + openapi_version="3.0.0", # openapi-generatorが対応するバージョン description=app.description, routes=app.routes, tags=app.openapi_tags,