Also, a followup: is there a way to specify exampl...
# ask-for-help
a
Also, a followup: is there a way to specify examples that will show up in the Swagger UI? In the past, I could set
input_spec.sample
. Not sure how to do that now with
1.2.x
.
s
With 1.2, you can simply use default values of arguments to the
@bentoml.api
.
a
How does this work if you’re using a subclass of
pydantic.BaseModel
and/or an
Annotated
argument with
pydantic.Field
as a default value?
s
Ah, if you use field, you can pass in a
default
argument to field, as in Pydantic. https://docs.pydantic.dev/latest/concepts/fields/
🙏 1
👍 1
a
Thanks, appreciate it! And sorry, I should’ve looked at the
pydantic
docs a bit more closely.
s
No problem at all. I should have given a more complete answer earlier.