Swagger.response: Add a response to the method (argumentĪccepted: response_code: The response to add to the method,ĭescription: The description of the response, schema: The Swagger.reorder_list_with: Same as swagger.reorder_with with Summary: Summary of the method (if setted in response, you don’t need it here)) Schema (default is 200), description: Description of the Schema to apply, as_list: Apply the schema as list (default isįalse), response_code: The response code to apply the example ![]() Swagger.reorder_with: Apply a schema and a response to a method,ĭefault response code is 200 (argument accepted: schema: the Swagger.tags: Allow to group operations with a list of tags You need to import swagger from flask_restful_swagger_3 You can decorate your Api endpoiints with several decorators to build to swagger object: List of decorators Maps to the title field of the info object. The title of the application (defaults to the flask app module name). Maps to the termsOfService field of the info object. Maps to the tags field fo the OpenAPI Object. ![]() Maps to the securitySchemes field of components ObjectĪ list of tags used by the specification with additional metadata. Maps to the security field of the OpenAPI Object.ĭefines a security scheme that can be used by the operations. Individual operations can override this definition. Only one of the security requirement objects need to be satisfied to authorize a request. The list of values includes alternative security requirement objects that can be used. Maps to the responses field of the operation object.Ī declaration of which security mechanisms can be used across the API. The responses that can be used across operations. Maps to the parameters field of the operation object. The parameters that can be used across operations. Maps to the license field of the info object. Maps to the externalDocs field of the operation object. Maps to the description field of the info object.Īdditional external documentation. Maps to the contact field of the info object.Ī short description of the application. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. Maps to the server object.Ī list reusable objects for different aspects of the OAS. ![]() The server on which the API is served, it replaces schemes, host and base_path. The URL path that serves the swagger specification document (defaults to swagger.json). The URL prefix for swagger (defaults to /api/doc) ![]() Maps to the version field of the info object. The API version string (defaults to ‘0.0’). Set to True to add an endpoint to serve the swagger specification (defaults to True). The Api class supports the following parameters: # It supports several (optional) parameters, these are the defaults: api = Api ( app ) from flask import Flask # Instead of using this: from flask_restful import Api # Use this: from flask_restful_swagger_3 import Api app = Flask ( _name_ ) # Use the swagger Api class as you would use the flask restful class. To use it, change your import from from flask_restful import Api toįrom flask_restful_swagger_3 import Api. Install: pip install flask-restful-swagger-3 Which enables swagger3 support according to theīut it only supported swagger 2.0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |