django-rest-swagger-swaggerdoc - Additional Document
Django REST Swagger 2.0 has changed drastically. For example, you may not put a return code in YAML files. This package provides functions to inject a swagger style yaml data to the django-rest-swagger’s data.
How to use it
Add rest_framework_swagger to your INSTALLED_APPS setting
settings.py:
INSTALLED_APPS = ( ... 'rest_framework_swagger', )You create a swagger style yaml file.
This YAML file is swagger style.
./api_test_doc.yml:
get: description: test document responses: 200: description: success 400: description: bad request schema: type: json headers: Content-Type: application/jsonYou create api view function or ViewClass.
The swaggerdoc decorator to specify the relative path from the file the view callable is defined.
views.py:
from rest_framework.decorators import api_view from rest_framework.views import APIView from django_rest_swagger_swaggerdoc import swaggerdoc @swaggerdoc('api_test_doc.yml') @api_view() def example_view(request): pass class ExampleView(APIView): @swaggerdoc('./api_test_doc.yml') def get(self, request): passYou create document schema view.
Use django_rest_swagger_swaggerdoc.renderers.SwaggerAdditinalDocRenderer. DO NOT USE rest_framework_swagger.renderers.OpenAPIRenderer.
views.py:
from rest_framework_swagger.renderers import SwaggerUIRenderer from rest_framework.decorators import api_view, renderer_classes from rest_framework import response, schemas from django_rest_swagger_swaggerdoc.renderers import SwaggerAdditinalDocRenderer @api_view() @renderer_classes([SwaggerUIRenderer, SwaggerAdditinalDocRenderer]) def schema_view(request): generator = schemas.SchemaGenerator(title='Pastebin API') return response.Response(generator.get_schema(request=request))
See example project: https://github.com/TakesxiSximada/django-rest-swagger-swaggerdoc/tree/master/examples
Install
$ pip install django-rest-swagger-swaggerdoc
It is depends on djangorestframework(>= 3.4.7). If older than version 3.7.4, it may not be able to correctly resolve the YAML path.
Other
Metadata
Release files for django-rest-swagger-swaggerdoc 1.0.post3
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 |
|---|---|---|---|---|
| django-rest-swagger-swaggerdoc-1.0.post3.tar.gz | 7.4 kB | Without provenance | Details for django-rest-swagger-swaggerdoc-1.0.post3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_rest_swagger_swaggerdoc-1.0.post3-py3-none-any.whl | Python 3 | none | any | Details for django_rest_swagger_swaggerdoc-1.0.post3-py3-none-any.whl |
Total release size: 19.6 kB
Release files / django-rest-swagger-swaggerdoc-1.0.post3.tar.gz
| Download URL | django-rest-swagger-swaggerdoc-1.0.post3.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3c733fcbc26c30a435c02003211a9b901368d127eae5bb7c8527bffe79d7ac2
|
|
BLAKE2b-256 checksum How to use checksums |
c4cfbacf236630bb72470ab6c4b8bf435e128ae21ab2ee62ad27b655e13af593
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_rest_swagger_swaggerdoc-1.0.post3-py3-none-any.whl
| Download URL | django_rest_swagger_swaggerdoc-1.0.post3-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fddcd76894ba1352433e092bfa6db51841cf0787968d09626c6d317a8433cb84
|
|
BLAKE2b-256 checksum How to use checksums |
da9aafac92b3c68561e5c815f6895e00b7b5b76ac0d10e06f478a648f04cccdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-rest-swagger-swaggerdoc 1.0.post3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.