Flask-Ninja
Flask-Ninja is a simple web API framework based on Flask. It uses Pydantic for validation and automatic generation of OpenAPI documentation. It’s heavily inspired by django-ninja framework.
Features
The key features of Flask-Ninja are:
Easy: Designed to be easy to use and intuitive.
Fast to code: Type hints and automatic docs lets you focus only on business logic.
Standards-based: Based on the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
Models based: Pydantic models support and automatic (de)serialization of requests/responses.
Secure: Natively supports various authentication methods for the requests.
Motivation
- There is plenty of similar libraries, but each one of them is missing something:
flask-openapi3 - can’t return a pydantic model, only a dict
flask-pydantic - doesn’t generate openapi schema
spectree - doesn’t support authentication
Additional features
parses docstrings of the endpoint handler function and uses them for documenting the endpoint in the generated documentation.
detects response schema from the return type annotation