In pydantic we can add an example to Fields, such as:
Field(default=None, example="A very nice Item")
Which will then be displayed in the swagger API docs:
How do we do this in sqlmodel? Adding the key example to the Field class in sqlmodel returns error:
Field() got an unexpected keyword argument 'example'
Thank you!
Can be accomplished using schema_extra
:
Field(default=None, schema_extra={'example': "A very nice Item"})
Can be found in code:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.