Flask + marshmallow + OpenAPI
Project description
Overview
Provides OpenAPI documentation generated from code for Flask APIs built around marshmallow schemas.
This hackish and organically grown ™ package was created because no other similar projects worked exactly the way I wanted them.
Similar projects:
Installation
pip install flask-marshmallow-openapi
Documentation
What does it do?
Searches your codebase for marshmallow schemas and 🎖️ decorated 🎖️ Flask routes.
It then produces swagger.json and injects it into self-hosted
ReDoc and
SwaggerUI documentation viewers.
api = flask.Blueprint("my_api", __name__)
class BookSchema(ma.Schema):
id = ma.fields.Integer(as_string=True)
title = ma.fields.String(allow_none=False)
publisher = ma.fields.String(allow_none=False)
isbn = ma.fields.String(allow_none=False)
@open_api.get_list(BookSchema)
@api.route("/books", methods=["GET"])
def books_list():
return "<p>Hello, World!</p>"
app = flask.Flask(__name__)
app.register_blueprint(api, url_prefix="/v1")
conf = OpenAPISettings(
api_version="v1", api_name="My API", app_package_name="my_api", mounted_at="/v1"
)
docs = OpenAPI(config=conf)
docs.init_app(app)
New app routes:
$ flask routes
Endpoint Methods Rule
--------------------- ------- -------------------------------
# ...
open_api.re_doc GET /v1/docs/re_doc
open_api.static GET /v1/docs/static/<path:filename>
open_api.swagger_json GET /v1/docs/static/swagger.json
open_api.swagger_ui GET /v1/docs/swagger_ui
open_api.swagger_yaml GET /v1/docs/static/swagger.yaml
# ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_marshmallow_openapi-0.7.0.tar.gz.
File metadata
- Download URL: flask_marshmallow_openapi-0.7.0.tar.gz
- Upload date:
- Size: 982.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
205f4a523081267e348cdd0240e0357e2d7e7c368b06604a7544d176f25a8c63
|
|
| MD5 |
632ac3c7d30e2bc9da908d8c44aef1e9
|
|
| BLAKE2b-256 |
49251c5766abf75146319bea4dd4afadf6d1540c27ca32cd4f08b4ea972d17d9
|
Provenance
The following attestation bundles were made for flask_marshmallow_openapi-0.7.0.tar.gz:
Publisher:
pypi-publish.yaml on tadams42/flask-marshmallow-openapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_marshmallow_openapi-0.7.0.tar.gz -
Subject digest:
205f4a523081267e348cdd0240e0357e2d7e7c368b06604a7544d176f25a8c63 - Sigstore transparency entry: 768559177
- Sigstore integration time:
-
Permalink:
tadams42/flask-marshmallow-openapi@4fb3c1cbcf05a9f0371ba9726085c682141f93dd -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/tadams42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@4fb3c1cbcf05a9f0371ba9726085c682141f93dd -
Trigger Event:
release
-
Statement type:
File details
Details for the file flask_marshmallow_openapi-0.7.0-py3-none-any.whl.
File metadata
- Download URL: flask_marshmallow_openapi-0.7.0-py3-none-any.whl
- Upload date:
- Size: 992.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
510d520370e6cdcc490a4d60cdfe391d4c52b95fce7d5a0237af057dcac76bfa
|
|
| MD5 |
6fbf40f690c8d2e6f1ba4189bb23e1e8
|
|
| BLAKE2b-256 |
2b5e37e6d385309168325a3898ecedcf1db9a27cbfd7d7a872eab9b7ede9af34
|
Provenance
The following attestation bundles were made for flask_marshmallow_openapi-0.7.0-py3-none-any.whl:
Publisher:
pypi-publish.yaml on tadams42/flask-marshmallow-openapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_marshmallow_openapi-0.7.0-py3-none-any.whl -
Subject digest:
510d520370e6cdcc490a4d60cdfe391d4c52b95fce7d5a0237af057dcac76bfa - Sigstore transparency entry: 768559183
- Sigstore integration time:
-
Permalink:
tadams42/flask-marshmallow-openapi@4fb3c1cbcf05a9f0371ba9726085c682141f93dd -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/tadams42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@4fb3c1cbcf05a9f0371ba9726085c682141f93dd -
Trigger Event:
release
-
Statement type: