Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example value for ParamSchema #176

Open
cdupont opened this issue Dec 3, 2018 · 1 comment
Open

Example value for ParamSchema #176

cdupont opened this issue Dec 3, 2018 · 1 comment

Comments

@cdupont
Copy link

cdupont commented Dec 3, 2018

I'd like to add an example value for a ParamSchema, to be able to see it in Swagger-UI.
For example for a Schema, I added an example:

instance ToSchema Foo where
   declareNamedSchema proxy = genericDeclareNamedSchema defaultSchemaOptions proxy
         & mapped.schema.example ?~ toJSON defaultFoo

The example value "defaultFoo" will render in Swagger for the body of a request. But for a URL parameter, how to get the example?

@phadej
Copy link
Collaborator

phadej commented Dec 3, 2018

Parameter objects doesn't seem to include examples https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-object says

There are various other fields you can use.

Not in the spec: Swagger UI won't show them either :(

I'm not sure about OpenAPI3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants