Replies: 3 comments 1 reply
-
The problem is not so much the null type as it is the Literal annotation, I think we should fix this at the level of the model creation instead. Currently, if you make a Literal of type string, you have no way to know what is the type in the schema either. Overloading this method should do the trick: I have implemented the solution in another project where I am making my custom json model creator since the default pydantic one has some rough edges. Happy to make a PR if you want to go in this direction, as it would make my life easier as well. |
Beta Was this translation helpful? Give feedback.
-
Tracking pydantic/pydantic#8905 |
Beta Was this translation helpful? Give feedback.
-
As the previously mentioned Pydantic issue was fixed, this discussion should be turned into a new issue to update pydantic to the latest release, once available (currently tracked in pydantic/pydantic#8993). |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Currently, fields which are constant and None are described as:
However, the type goes missing when rendering the schema:
Describe the solution you'd like
We can get the same behavior by just making the field a NoneType:
which renders as:
Describe alternatives you've considered
We can leave things as they are, but we'd have to modify the schema when rendering to guis.
Additional context
Add any other context or screenshots about the feature request here.
Beta Was this translation helpful? Give feedback.
All reactions