Python JavaScript HTML Other
Clone or download
Latest commit 412f986 Apr 30, 2018
Permalink
Failed to load latest commit information.
client Add ability to bake custom headers, accept version Apr 30, 2018
docs Merge pull request #706 from williln/patch-1 Apr 30, 2018
example_app Add ability to bake custom headers, accept version Apr 30, 2018
rest_framework_swagger Bump version Apr 30, 2018
tests Add ability to bake custom headers, accept version Apr 30, 2018
.coveragerc Add code coverage. Jul 18, 2016
.dockerignore Add Dockerfile + bash as convenience to run the example_app. Jul 18, 2016
.github_changelog_generator Bump version Apr 30, 2018
.gitignore Create small webpack app to include swagger ui Apr 27, 2018
.travis.yml Fix codestyle / lint errors Apr 30, 2018
CHANGELOG.md Bump version Apr 30, 2018
Dockerfile Use entrypoint for Dockerfile #524. Aug 20, 2016
LICENSE Add license to docs, quick explanation of changes in v2. Jul 14, 2016
MANIFEST.in Include license, readme and exclude bytecode. Jul 20, 2016
Procfile Fix example app configuration on heroku Mar 12, 2017
README.md Update README.md Mar 29, 2017
app.json Fix example app configuration on heroku Mar 12, 2017
mkdocs.yml Update documentation. Oct 16, 2016
pylintrc Add pylint Jul 21, 2016
requirements.txt Merge branch 'feature/ui-v3' into master Apr 30, 2018
run_example.sh run_example: fix "docker build" command Aug 17, 2016
runtests.py Make tests independent from django example app. Aug 16, 2016
runtime.txt Fix example app configuration on heroku Mar 12, 2017
setup.cfg add wheel support Jan 24, 2016
setup.py Django 1.11 is now a valid classifier Jul 7, 2017
tox.ini Update for DJ 2.0, DRF 3.8 compat Apr 30, 2018

README.md

Django REST Swagger

build-status-badge codecov pypi-version Dependency Status

Deploy

An API documentation generator for Swagger UI and Django REST Framework

Full documentation: http://marcgibbons.github.io/django-rest-swagger/

Installation

  1. pip install django-rest-swagger

  2. Add rest_framework_swagger to your INSTALLED_APPS setting:

        INSTALLED_APPS = (
            ...
            'rest_framework_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_framework_swagger.views import get_swagger_view

schema_view = get_swagger_view(title='Pastebin API')

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

Requirements

  • Django 1.8+
  • Django REST framework 3.5.1+
  • Python 2.7, 3.5, 3.6

Testing

  • Run $ tox to execute the test suite against all supported environments.
  • Run ./runtests.py to run the test suite within the current environment.

Bugs & Contributions

Please report bugs by opening an issue

Contributions are welcome and are encouraged!

Special Thanks

Many thanks to Tom Christie & all the contributors who have developed Django REST Framework