Name | apispec-flask-restful JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | Flask-RESTful plugin for apispec. |
upload_time | 2024-12-10 10:20:06 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | The MIT License (MIT) Copyright (c) 2017 theirix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
apispec
swagger
openapi
specification
documentation
spec
rest api
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
=====================
apispec_flask_restful
=====================
.. image:: https://badge.fury.io/py/apispec-flask-restful.svg
:target: https://badge.fury.io/py/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
-------------
.. code-block:: python
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:
.. code-block:: python
spec.path(resource=HelloResource, path='/hello')
With Blueprint
--------------
Flask blueprints are supported too by passing Flask app in `app` parameter:
.. code-block:: python
spec.path(resource=HelloResource, api=api, app=app)
Raw data
{
"_id": null,
"home_page": null,
"name": "apispec-flask-restful",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "apispec, swagger, openapi, specification, documentation, spec, rest api",
"author": null,
"author_email": "theirix <theirix@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/3d/be/807b33b897b3947fc4c9ec2c85395ff7ada3a70e4e7b9e488f22db512485/apispec_flask_restful-0.3.1.tar.gz",
"platform": null,
"description": "=====================\napispec_flask_restful\n=====================\n\n.. image:: https://badge.fury.io/py/apispec-flask-restful.svg\n :target: https://badge.fury.io/py/apispec-flask-restful\n\nFlask-RESTful plugin.\n\nIncludes a path helper that allows you to pass a Flask-RESTful resource object to `path`.\n\nInspired by AndrewPashkin/apispec_restful plugin.\n\nInstall\n=======\n\n::\n\n pip install apispec_flask_restful\n\nUsage\n===========\n\nTypical usage\n-------------\n\n.. code-block:: python\n\n from pprint import pprint\n\n from flask_restful import Api, Resource\n from flask import Flask\n from apispec import APISpec\n from apispec_flask_restful import RestfulPlugin\n\n class HelloResource(Resource):\n def get(self, hello_id):\n '''A greeting endpoint.\n ---\n description: get a greeting\n responses:\n 200:\n description: a pet to be returned\n schema:\n $ref: #/definitions/Pet\n '''\n pass\n\n app = Flask(__name__)\n api = Api(app)\n spec = APISpec(title='Spec', version='1.0', openapi_version='3.0.2', plugins=[RestfulPlugin()])\n\n api.add_resource(HelloResource, '/hello')\n\n spec.path(resource=HelloResource, api=api)\n pprint(spec.to_dict()['paths'])\n\n # OrderedDict([('/hello',\n # {'get': {'description': 'get a greeting',\n # 'responses': {200: {'description': 'a pet to be returned',\n # 'schema': {'$ref': None}}}}})])\n\nWithout API\n-----------\n\nMethod `path` can be invoked with a resource path in a `path` parameter instead of `api` parameter:\n\n.. code-block:: python\n\n spec.path(resource=HelloResource, path='/hello')\n\nWith Blueprint\n--------------\n\nFlask blueprints are supported too by passing Flask app in `app` parameter:\n\n.. code-block:: python\n\n spec.path(resource=HelloResource, api=api, app=app)\n\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright (c) 2017 theirix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Flask-RESTful plugin for apispec.",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/theirix/apispec-flask-restful",
"Repository": "https://github.com/theirix/apispec-flask-restful"
},
"split_keywords": [
"apispec",
" swagger",
" openapi",
" specification",
" documentation",
" spec",
" rest api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3cef6f5f1d71ade3db30a060647bab40d25d8f3c7c8a8e532aac6ea49394a29e",
"md5": "ffe021aa114c38c87af709968d384238",
"sha256": "c18354ee8a06aa3862f506c14e7451367e9b40535208eae184e6e905606e3752"
},
"downloads": -1,
"filename": "apispec_flask_restful-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ffe021aa114c38c87af709968d384238",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5399,
"upload_time": "2024-12-10T10:20:05",
"upload_time_iso_8601": "2024-12-10T10:20:05.699352Z",
"url": "https://files.pythonhosted.org/packages/3c/ef/6f5f1d71ade3db30a060647bab40d25d8f3c7c8a8e532aac6ea49394a29e/apispec_flask_restful-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3dbe807b33b897b3947fc4c9ec2c85395ff7ada3a70e4e7b9e488f22db512485",
"md5": "c94a1ef7e77c4a17656199d2dda39c9c",
"sha256": "e74034c986ed1304cbaff8e86c115bd806ba1efc36b3df5d739b84f679193de1"
},
"downloads": -1,
"filename": "apispec_flask_restful-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "c94a1ef7e77c4a17656199d2dda39c9c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5430,
"upload_time": "2024-12-10T10:20:06",
"upload_time_iso_8601": "2024-12-10T10:20:06.924233Z",
"url": "https://files.pythonhosted.org/packages/3d/be/807b33b897b3947fc4c9ec2c85395ff7ada3a70e4e7b9e488f22db512485/apispec_flask_restful-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 10:20:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "theirix",
"github_project": "apispec-flask-restful",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "apispec-flask-restful"
}