-
Notifications
You must be signed in to change notification settings - Fork 34
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
bugfix for gneerics class #107
bugfix for gneerics class #107
Conversation
75d3f5c
to
a41f82e
Compare
|
||
|
||
class ListGenericResponse(GenericModel, Generic[T]): | ||
items: List[GenericResponse[T]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used list
here last time, but in python 3.7 etc. it has to be List
, so I modified it
@ota42y Hi, there seems to be somewhere else that needs to normalize the name, such as the Also, I would like to add And can you write a unit test in new Can you continue to complete it? |
When we use generics in responses, the schema name include `[]` but [OpenAPI 3 doesn't allow it](https://spec.openapis.org/oas/v3.1.0#components-object). ``` All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$. ``` The pydantic normalize all `$ref` but the schema name ( `components.schemas` ) set by this library so we shuld normalize name using pydantic's function.
a41f82e
to
a99a495
Compare
@luolingchun
This PR changes will be conflict to this PR #106 but I think thease test should be in the |
Checklist:
pytest tests
and no failed.flake8 flask_openapi3 tests examples
and no failed.mypy flask_openapi3
and no failed.mkdocs serve
and no failed.When we use generics in responses, the schema name include
[]
but OpenAPI 3 doesn't allow it.The pydantic normalize all
$ref
but the schema name (components.schemas
) set by this library so we shuld normalize name using pydantic's function.