Flask-RESTful plugin for apispec.
Project description
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)
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 apispec_flask_restful-0.3.1.tar.gz.
File metadata
- Download URL: apispec_flask_restful-0.3.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e74034c986ed1304cbaff8e86c115bd806ba1efc36b3df5d739b84f679193de1
|
|
| MD5 |
c94a1ef7e77c4a17656199d2dda39c9c
|
|
| BLAKE2b-256 |
3dbe807b33b897b3947fc4c9ec2c85395ff7ada3a70e4e7b9e488f22db512485
|
Provenance
The following attestation bundles were made for apispec_flask_restful-0.3.1.tar.gz:
Publisher:
publish.yml on theirix/apispec-flask-restful
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apispec_flask_restful-0.3.1.tar.gz -
Subject digest:
e74034c986ed1304cbaff8e86c115bd806ba1efc36b3df5d739b84f679193de1 - Sigstore transparency entry: 154420181
- Sigstore integration time:
-
Permalink:
theirix/apispec-flask-restful@c9780060d6ae118b2732700af8691d4b3b18bc4a -
Branch / Tag:
refs/tags/0.3.1 - Owner: https://github.com/theirix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9780060d6ae118b2732700af8691d4b3b18bc4a -
Trigger Event:
release
-
Statement type:
File details
Details for the file apispec_flask_restful-0.3.1-py3-none-any.whl.
File metadata
- Download URL: apispec_flask_restful-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c18354ee8a06aa3862f506c14e7451367e9b40535208eae184e6e905606e3752
|
|
| MD5 |
ffe021aa114c38c87af709968d384238
|
|
| BLAKE2b-256 |
3cef6f5f1d71ade3db30a060647bab40d25d8f3c7c8a8e532aac6ea49394a29e
|
Provenance
The following attestation bundles were made for apispec_flask_restful-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on theirix/apispec-flask-restful
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apispec_flask_restful-0.3.1-py3-none-any.whl -
Subject digest:
c18354ee8a06aa3862f506c14e7451367e9b40535208eae184e6e905606e3752 - Sigstore transparency entry: 154420182
- Sigstore integration time:
-
Permalink:
theirix/apispec-flask-restful@c9780060d6ae118b2732700af8691d4b3b18bc4a -
Branch / Tag:
refs/tags/0.3.1 - Owner: https://github.com/theirix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9780060d6ae118b2732700af8691d4b3b18bc4a -
Trigger Event:
release
-
Statement type: