Closed MacroPower closed 3 years ago
Hello,
I had the same question as this stackoverflow user.
This seems to be supported by swagger: https://swagger.io/docs/specification/2-0/adding-examples/
I would expect then to be able to write something like this:
return SwaggerModelData.ForType<Type>(with => { with.Property(x => x.Name) .Description("Name of the user") .Example("James Johnson") });
Thus clicking "Try it out" for a MetaDataModule with a BodyParameter that has .Schema<Type> would give me the example json:
.Schema<Type>
{ "name": "James Johnson" }
Rather than
{ "name": "string" }
A fairly trivial example, but it would be nice for large bodies with a lot of information (some of which may need to conform to some standards).
Believe I've found a way to do this, at least partially. See my answer here: https://stackoverflow.com/a/58634621
Hello,
I had the same question as this stackoverflow user.
This seems to be supported by swagger: https://swagger.io/docs/specification/2-0/adding-examples/
I would expect then to be able to write something like this:
Thus clicking "Try it out" for a MetaDataModule with a BodyParameter that has
.Schema<Type>
would give me the example json:Rather than
A fairly trivial example, but it would be nice for large bodies with a lot of information (some of which may need to conform to some standards).