summaryrefslogtreecommitdiff
path: root/python-falcon-apispec.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-12 00:24:03 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-12 00:24:03 +0000
commit916d71fcbeb095e786886efcb3e1f7c352dd4a13 (patch)
treef46785ff0f113b6f439f9cda6a054c8c925d2eea /python-falcon-apispec.spec
parent39574feee0029375e105e47c2d98058a3365a730 (diff)
automatic import of python-falcon-apispec
Diffstat (limited to 'python-falcon-apispec.spec')
-rw-r--r--python-falcon-apispec.spec396
1 files changed, 396 insertions, 0 deletions
diff --git a/python-falcon-apispec.spec b/python-falcon-apispec.spec
new file mode 100644
index 0000000..5ececf1
--- /dev/null
+++ b/python-falcon-apispec.spec
@@ -0,0 +1,396 @@
+%global _empty_manifest_terminate_build 0
+Name: python-falcon-apispec
+Version: 0.4.0
+Release: 1
+Summary: Falcon plugin for apispec documentation generator.
+License: MIT License
+URL: https://github.com/alysivji/falcon-apispec
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/9c/6a/4b55d1d01cf23f66c3acf514a70568ac0abc55e33b9b83238e9a2da8f5f7/falcon-apispec-0.4.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-PyYAML
+Requires: python3-apispec
+Requires: python3-falcon
+
+%description
+ description: Get a random pet
+ responses:
+ 200:
+ description: A pet to be returned
+ schema: PetSchema
+ """
+ pet = get_random_pet() # returns JSON
+ resp.media = pet
+# create instance of resource
+random_pet_resource = RandomPetResource()
+# pass into `add_route` for Falcon
+app.add_route("/random", random_pet_resource)
+# Create an APISpec
+spec = APISpec(
+ title='Swagger Petstore',
+ version='1.0.0',
+ openapi_version='2.0',
+ plugins=[
+ FalconPlugin(app),
+ MarshmallowPlugin(),
+ ],
+)
+# Register entities and paths
+spec.components.schema('Category', schema=CategorySchema)
+spec.components.schema('Pet', schema=PetSchema)
+# pass created resource into `path` for APISpec
+spec.path(resource=random_pet_resource)
+```
+### Generated OpenAPI Spec
+```python
+spec.to_dict()
+# {
+# "info": {
+# "title": "Swagger Petstore",
+# "version": "1.0.0"
+# },
+# "swagger": "2.0",
+# "paths": {
+# "/random": {
+# "get": {
+# "description": "A cute furry animal endpoint.",
+# "responses": {
+# "200": {
+# "schema": {
+# "$ref": "#/definitions/Pet"
+# },
+# "description": "A pet to be returned"
+# }
+# },
+# }
+# }
+# },
+# "definitions": {
+# "Pet": {
+# "properties": {
+# "category": {
+# "type": "array",
+# "items": {
+# "$ref": "#/definitions/Category"
+# }
+# },
+# "name": {
+# "type": "string"
+# }
+# }
+# },
+# "Category": {
+# "required": [
+# "name"
+# ],
+# "properties": {
+# "name": {
+# "type": "string"
+# },
+# "id": {
+# "type": "integer",
+# "format": "int32"
+# }
+# }
+# }
+# },
+# }
+spec.to_yaml()
+# definitions:
+# Pet:
+# enum: [name, photoUrls]
+# properties:
+# id: {format: int64, type: integer}
+# name: {example: doggie, type: string}
+# info: {description: 'This is a sample Petstore server. You can find out more ', title: Swagger Petstore, version: 1.0.0}
+# parameters: {}
+# paths: {}
+# security:
+# - apiKey: []
+# swagger: '2.0'
+# tags: []
+```
+## Contributing
+### Setting Up for Local Development
+1. Fork falcon-apispec on Github
+2. Install development requirements. Virtual environments are highly recommended
+```console
+pip install -r requirements.txt
+```
+### Running Tests
+```console
+pytest
+```
+
+%package -n python3-falcon-apispec
+Summary: Falcon plugin for apispec documentation generator.
+Provides: python-falcon-apispec
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-falcon-apispec
+ description: Get a random pet
+ responses:
+ 200:
+ description: A pet to be returned
+ schema: PetSchema
+ """
+ pet = get_random_pet() # returns JSON
+ resp.media = pet
+# create instance of resource
+random_pet_resource = RandomPetResource()
+# pass into `add_route` for Falcon
+app.add_route("/random", random_pet_resource)
+# Create an APISpec
+spec = APISpec(
+ title='Swagger Petstore',
+ version='1.0.0',
+ openapi_version='2.0',
+ plugins=[
+ FalconPlugin(app),
+ MarshmallowPlugin(),
+ ],
+)
+# Register entities and paths
+spec.components.schema('Category', schema=CategorySchema)
+spec.components.schema('Pet', schema=PetSchema)
+# pass created resource into `path` for APISpec
+spec.path(resource=random_pet_resource)
+```
+### Generated OpenAPI Spec
+```python
+spec.to_dict()
+# {
+# "info": {
+# "title": "Swagger Petstore",
+# "version": "1.0.0"
+# },
+# "swagger": "2.0",
+# "paths": {
+# "/random": {
+# "get": {
+# "description": "A cute furry animal endpoint.",
+# "responses": {
+# "200": {
+# "schema": {
+# "$ref": "#/definitions/Pet"
+# },
+# "description": "A pet to be returned"
+# }
+# },
+# }
+# }
+# },
+# "definitions": {
+# "Pet": {
+# "properties": {
+# "category": {
+# "type": "array",
+# "items": {
+# "$ref": "#/definitions/Category"
+# }
+# },
+# "name": {
+# "type": "string"
+# }
+# }
+# },
+# "Category": {
+# "required": [
+# "name"
+# ],
+# "properties": {
+# "name": {
+# "type": "string"
+# },
+# "id": {
+# "type": "integer",
+# "format": "int32"
+# }
+# }
+# }
+# },
+# }
+spec.to_yaml()
+# definitions:
+# Pet:
+# enum: [name, photoUrls]
+# properties:
+# id: {format: int64, type: integer}
+# name: {example: doggie, type: string}
+# info: {description: 'This is a sample Petstore server. You can find out more ', title: Swagger Petstore, version: 1.0.0}
+# parameters: {}
+# paths: {}
+# security:
+# - apiKey: []
+# swagger: '2.0'
+# tags: []
+```
+## Contributing
+### Setting Up for Local Development
+1. Fork falcon-apispec on Github
+2. Install development requirements. Virtual environments are highly recommended
+```console
+pip install -r requirements.txt
+```
+### Running Tests
+```console
+pytest
+```
+
+%package help
+Summary: Development documents and examples for falcon-apispec
+Provides: python3-falcon-apispec-doc
+%description help
+ description: Get a random pet
+ responses:
+ 200:
+ description: A pet to be returned
+ schema: PetSchema
+ """
+ pet = get_random_pet() # returns JSON
+ resp.media = pet
+# create instance of resource
+random_pet_resource = RandomPetResource()
+# pass into `add_route` for Falcon
+app.add_route("/random", random_pet_resource)
+# Create an APISpec
+spec = APISpec(
+ title='Swagger Petstore',
+ version='1.0.0',
+ openapi_version='2.0',
+ plugins=[
+ FalconPlugin(app),
+ MarshmallowPlugin(),
+ ],
+)
+# Register entities and paths
+spec.components.schema('Category', schema=CategorySchema)
+spec.components.schema('Pet', schema=PetSchema)
+# pass created resource into `path` for APISpec
+spec.path(resource=random_pet_resource)
+```
+### Generated OpenAPI Spec
+```python
+spec.to_dict()
+# {
+# "info": {
+# "title": "Swagger Petstore",
+# "version": "1.0.0"
+# },
+# "swagger": "2.0",
+# "paths": {
+# "/random": {
+# "get": {
+# "description": "A cute furry animal endpoint.",
+# "responses": {
+# "200": {
+# "schema": {
+# "$ref": "#/definitions/Pet"
+# },
+# "description": "A pet to be returned"
+# }
+# },
+# }
+# }
+# },
+# "definitions": {
+# "Pet": {
+# "properties": {
+# "category": {
+# "type": "array",
+# "items": {
+# "$ref": "#/definitions/Category"
+# }
+# },
+# "name": {
+# "type": "string"
+# }
+# }
+# },
+# "Category": {
+# "required": [
+# "name"
+# ],
+# "properties": {
+# "name": {
+# "type": "string"
+# },
+# "id": {
+# "type": "integer",
+# "format": "int32"
+# }
+# }
+# }
+# },
+# }
+spec.to_yaml()
+# definitions:
+# Pet:
+# enum: [name, photoUrls]
+# properties:
+# id: {format: int64, type: integer}
+# name: {example: doggie, type: string}
+# info: {description: 'This is a sample Petstore server. You can find out more ', title: Swagger Petstore, version: 1.0.0}
+# parameters: {}
+# paths: {}
+# security:
+# - apiKey: []
+# swagger: '2.0'
+# tags: []
+```
+## Contributing
+### Setting Up for Local Development
+1. Fork falcon-apispec on Github
+2. Install development requirements. Virtual environments are highly recommended
+```console
+pip install -r requirements.txt
+```
+### Running Tests
+```console
+pytest
+```
+
+%prep
+%autosetup -n falcon-apispec-0.4.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-falcon-apispec -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.0-1
+- Package Spec generated