You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm trying to find out how to properly create swagger examples. I have tried a number of different things but I haven't gotten it to work and I don't see any mention of this anywhere in here.
code
Here you can see I am attempting to add the kwarg examples to my pydantic Field.
Field(..., examples='John Doe')
I see that the pydantic FieldInfo object annotates this argument as a list (here) examples: list[Any] | None and tried that in various ways to no avail:
examples=[{'test': 'John Doe'}]
examples=[{'test': {'value': 'John Doe'}}]
result
And here you can see that in swagger it does add the field key to the example but not the value.
What I see
{
"driver_fullname": "string"
}
What I expected
{
"driver_fullname": "John Doe"
}
The text was updated successfully, but these errors were encountered:
Hi! I'm trying to find out how to properly create swagger examples. I have tried a number of different things but I haven't gotten it to work and I don't see any mention of this anywhere in here.
code
Here you can see I am attempting to add the kwarg
examples
to my pydanticField
.I see that the pydantic
FieldInfo
object annotates this argument as a list (here)examples: list[Any] | None
and tried that in various ways to no avail:examples=[{'test': 'John Doe'}]
examples=[{'test': {'value': 'John Doe'}}]
result
And here you can see that in swagger it does add the field key to the example but not the value.
What I see
What I expected
The text was updated successfully, but these errors were encountered: