-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: SecuritySchemeData root_validator conflicts with alias #350
Comments
Hi @jelmerk, thanks for the feedback. This is a bit tricky. Alias here is necessary since “in” is a keyword in Python. Let me check if we can make it work with the “root_validator”. |
I found that field with class Model(BaseModel):
schema_x: str = Field(
description="xxx",
alias="schema"
)
Model(schema_x="xyz") This will panic since I didn't find any other solutions. |
Fix #350 - keyword with no conflict in alias Co-authored-by: Keming <[email protected]>
Describe the bug
Impossible to create SecuritySchemeData with field_in field because of the alias="in" field on the pydantic field_in field
To Reproduce
Expected behavior
Should create a valid SecuritySchemeData but instead raises this exception
The spectree version
Name: spectree
Version: 1.2.3
Summary: generate OpenAPI document and validate request&response with Python annotations.
Home-page:
Author:
Author-email: Keming Yang [email protected]
License: Apache-2.0
Location: /Users/jkuperus/Library/Caches/pypoetry/virtualenvs/data-workflow-service-VxjL5469-py3.8/lib/python3.8/site-packages
Requires: pydantic
Required-by:
Darwin Jelmers-MacBook-Pro.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Python 3.8.10
Additional context
As a workaround you can do
The text was updated successfully, but these errors were encountered: