Skip to content

How can I provide query parameter example values? #139

Open
@alexwaibel

Description

@alexwaibel

Ask a question
When using the @api.doc() decorator, how can I provide an example request value?

Additional context
The documentation for @api.doc() is rather incomplete at the moment but I've been able to piece together the following request decorator:

@api.doc(params={'someparam: {'description': 'A param description', 'in': 'query', 'type': 'string', 'required': 'true'}})

The above works as expected passing all of the information to swagger. However, the following does not pass the example value to Swagger:

@api.doc(params={'someparam: {'description': 'A param description', 'in': 'query', 'type': 'string', 'required': 'true', 'example': 'example_value'}})

Is there some way to pass this example value along that I'm missing?

Somewhat related, though not the subject of the question; I've also noticed the following works to add a description to a route:

@api.doc(description='Some text describing the route')

However, the following does not work:

@api.doc(summary='Some text describing the route')

I had initially assumed these decorators were simply being parsed and passed directly into Swagger but that does not appear to be the case. I'm also open to other better ways to achieve this if any exist as the above decorators have grown quite large.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions