A Flask extension that automatically generates OpenAPI specs and embeds Swagger UI for your Flask API.
Flasgger is a Flask extension that automatically generates OpenAPI (formerly Swagger) specifications from your Flask API and embeds Swagger UI for interactive documentation. It solves the problem of maintaining separate API docs by allowing developers to define specs directly in their code using docstrings, YAML, or Marshmallow schemas, and includes built-in request validation.
Flask developers building RESTful APIs who need automated OpenAPI documentation and request validation without maintaining separate spec files.
Developers choose Flasgger because it integrates seamlessly with Flask, supports multiple spec definition methods (YAML, Marshmallow, docstrings), provides built-in Swagger UI, and includes validation—all while reducing boilerplate and keeping docs in sync with code.
Easy OpenAPI specs and Swagger UI for your Flask API
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works directly with Flask and Flask-RESTful, allowing spec definitions via docstrings or decorators without disrupting existing code, as shown in the examples with @swag_from and SwaggerView.
Supports multiple formats including YAML files, Python dictionaries, Marshmallow schemas, and docstrings, giving developers choice in how they document APIs, detailed in the 'Getting started' section.
Automatically validates POST, PUT, and PATCH data against OpenAPI schemas, reducing boilerplate code; it includes custom validation functions and error handlers as demonstrated in the validation examples.
Provides an interactive documentation interface at /apidocs with support for Swagger UI 2 and 3, making API testing straightforward without external tools.
OpenAPI 3.0 support is labeled experimental and tied to Swagger UI 3, which may lead to instability or incomplete feature implementation for teams needing the latest spec standards.
Using features like Marshmallow schemas or custom validation requires additional dependencies (e.g., marshmallow apispec) and configuration, adding complexity beyond basic usage.
As a Flask extension, it tightly couples your API documentation to the Flask framework, making migration to other frameworks like FastAPI more difficult and limiting flexibility.