how can i add 'value example' (like on picture 3) to swagger documentation (picture 4 is that where i want to put 'value example' in) without using decorator marshall_with/marshall_list_with? Cuz the function got two responses depending on two endpoints
Asked
Active
Viewed 625 times
3

Chep
- 41
- 2
1 Answers
0
You can use the model to define an example, like this:
...
# define model with example
example_response = api.model('ExampleResponse', {
'field_you_want': fields.String(example="Example Value")
})
@api.route("/")
class Example(Resource):
@api.marshal_with(example_response)
def get(self):
response = get_response()
return response, 200
...

natielle
- 380
- 3
- 14