Skip to main content

Implementation of Swagger UI for Django Rest Framework

Project description

.. role:: python(code) :language: python

Rest-Swagger

An API documentation generator for Swagger UI and Django REST Framework

Buy Me A Coffee

Installation

  1. pip install rest-swagger

  2. Add rest_swagger to your INSTALLED_APPS setting:

        INSTALLED_APPS = (
            ...
            'rest_swagger',
        )
    

Rendering Swagger Specification and Documentation

This package ships with two renderer classes:

  1. OpenAPIRenderer generates the OpenAPI (fka Swagger) JSON schema specification. This renderer will be presented if:
  • Content-Type: application/openapi+json is specified in the headers.
  • ?format=openapi is passed as query param
  1. SwaggerUIRenderer generates the Swagger UI and requires the OpenAPIRenderer

Quick Start Example:

from django.conf.urls import url
from rest_swagger.views import get_swagger_view

schema_view = get_swagger_view(title='Pastebin API')

urlpatterns = [
    url(r'^$', schema_view)
]

Requirements

  • Django >=2.2
  • Django REST framework >=3.5
  • Python >=3.7

Bugs & Contributions

Please report bugs by opening an issue

Contributions are welcome and are encouraged!

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

rest-swagger-1.0.0.tar.gz (498.3 kB view hashes)

Uploaded Source

Built Distribution

rest_swagger-1.0.0-py2.py3-none-any.whl (555.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page