1

I am using Swagger as my API tooling framework and I just found this page: https://petstore.swagger.io/ and saw how each method has a description.

For example: POST: pet/ is described by add a new Pet to the store.

I thought adding this kind of description in PyCharm, using Flask-RESTX. How can I do this? I read the specification page of RESTX, but I didn't find any useful help.

VG_PyGirl
  • 11
  • 2
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community May 24 '22 at 15:40

2 Answers2

0

Flask-swagger provides a method (swagger) that inspects the Flask app for endpoints that contain YAML docstrings with Swagger 2.0 Operation objects.

So this is a way to add description and summary.

class Data(Resource):
   @api.doc(description="getSomething")
   def get(self):
      """getsomething"""
      ....

Then it will add description and summary.

BTSM
  • 1,585
  • 8
  • 12
  • 26
-1

You should have a swagger.yml.

summary: <your description here>

Basic Structure

stahh
  • 149
  • 5
  • Thanks, but it is not clear, can I add it like the description of field, like a decorator? For example, I use @api.doc. – VG_PyGirl May 27 '22 at 11:05