apispec_flask_restful
Flask-RESTful plugin.
Includes a path helper that allows you to pass a Flask-RESTful resource object to path.
Inspired by AndrewPashkin/apispec_restful plugin.
Install
pip install apispec_flask_restful
Usage
Typical usage
from pprint import pprint
from flask_restful import Api, Resource
from flask import Flask
from apispec import APISpec
from apispec_flask_restful import RestfulPlugin
class HelloResource(Resource):
def get(self, hello_id):
'''A greeting endpoint.
---
description: get a greeting
responses:
200:
description: a pet to be returned
schema:
$ref: #/definitions/Pet
'''
pass
app = Flask(__name__)
api = Api(app)
spec = APISpec(title='Spec', version='1.0', openapi_version='3.0.2', plugins=[RestfulPlugin()])
api.add_resource(HelloResource, '/hello')
spec.path(resource=HelloResource, api=api)
pprint(spec.to_dict()['paths'])
# OrderedDict([('/hello',
# {'get': {'description': 'get a greeting',
# 'responses': {200: {'description': 'a pet to be returned',
# 'schema': {'$ref': None}}}}})])
Without API
Method path can be invoked with a resource path in a path parameter instead of api parameter:
spec.path(resource=HelloResource, path='/hello')
With Blueprint
Flask blueprints are supported too by passing Flask app in app parameter:
spec.path(resource=HelloResource, api=api, app=app)
Metadata
Release files for apispec-flask-restful 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apispec_flask_restful-0.3.1.tar.gz | 5.4 kB | With provenance | Details for apispec_flask_restful-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apispec_flask_restful-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for apispec_flask_restful-0.3.1-py3-none-any.whl |
Total release size: 10.8 kB
Release files / apispec_flask_restful-0.3.1.tar.gz
| Download URL | apispec_flask_restful-0.3.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e74034c986ed1304cbaff8e86c115bd806ba1efc36b3df5d739b84f679193de1
|
|
BLAKE2b-256 checksum How to use checksums |
3dbe807b33b897b3947fc4c9ec2c85395ff7ada3a70e4e7b9e488f22db512485
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 10, 2024.
Transparency logRelease files / apispec_flask_restful-0.3.1-py3-none-any.whl
| Download URL | apispec_flask_restful-0.3.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c18354ee8a06aa3862f506c14e7451367e9b40535208eae184e6e905606e3752
|
|
BLAKE2b-256 checksum How to use checksums |
3cef6f5f1d71ade3db30a060647bab40d25d8f3c7c8a8e532aac6ea49394a29e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 10, 2024.
Transparency logSecurity for apispec-flask-restful 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for apispec_flask_restful-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 10, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.