`pydantic_model_creator` should support JSONField annotation (type hints)
LanceMoe opened this issue · 0 comments
LanceMoe commented
Is your feature request related to a problem? Please describe.
The types of JSONField are all displayed as Any in swagger:
I need to import openapi.json
into a TypeScript project for use, and this makes the generated openapi.json
very poor in usability.
Describe the solution you'd like
I found in tortoise/contrib/pydantic/creator.py
has
# Json fields
elif field_type is JSONField:
properties[fname] = Any
I think we can avoid any by adding an optional type json_schema
when defining the field, like this:
Or is there any better way to achieve this?