django-rest-swagger-swaggerdoc
Project description
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
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/json
You 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): pass
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
Project details
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
Close
Hashes for django-rest-swagger-swaggerdoc-1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2711f5e7fb4b271cebbe583e88a4d4734dbc8cc727a929a2537f53b5c61443a3 |
|
MD5 | 51a014c654585b7bfea508da09841589 |
|
BLAKE2b-256 | fb4f7218165d02bc267824e62e3222d313490da4af55a38848aad31199316640 |
Close
Hashes for django_rest_swagger_swaggerdoc-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5026c3a3914025c8ca41796ed6230c75843f96d1df958b31ab8593da06009db |
|
MD5 | 940bbce908ebec15b7167f07e4b66c28 |
|
BLAKE2b-256 | 8837857600fda75d1014932ccbf1f20cac8b13e36dbebb0a3160df96079977f6 |