Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcgibbons committed Jul 14, 2016
2 parents 603d0b7 + 2e70cae commit 6956ce8
Show file tree
Hide file tree
Showing 169 changed files with 27,931 additions and 19,602 deletions.
104 changes: 74 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,91 @@
docs/swagger.png
*.pyc
*.ropeproject
*env/
swag/
# Extended from https://github.com/github/gitignore/blob/master/Python.gitignore
*.py[cod]
*.coverage
*$py.class

# C extensions
*.so

# Packages
*.egg
*.egg-info
build
eggs
parts
bin
var
sdist
develop-eggs
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
lib64
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.tox
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Mr Developer
.idea
.mr.developer.cfg
.project
.pydevproject

tests/cigar_example/rest_framework_swagger
db.sql
tests/cigar_example/static
supervisord.log
tests/cigar_example/static_root/
dist
*.db
site/
37 changes: 2 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,12 @@
language: python
# This only controls the version of Python used to run tox, the
# versions used for the tests are handled by tox itself. Python 3.5
# is only installed if we explicitly request it, so we have to use
# it as the base, so that it's available to tox. Python 2.7 and 3.4
# are available in the Travis images by default. See:
# https://github.com/travis-ci/travis-ci/issues/4794#issuecomment-143758799
python: "3.5"

sudo: false

env:
- TOX_ENV=py27-flake8
- TOX_ENV=py27-django1.8-drf2.3
- TOX_ENV=py27-django1.8-drf2.4
- TOX_ENV=py27-django1.8-drf3.0
- TOX_ENV=py27-django1.8-drf3.1
- TOX_ENV=py27-django1.8-drf3.2
- TOX_ENV=py27-django1.8-drf3.3
- TOX_ENV=py27-django1.9-drf3.3
- TOX_ENV=py33-django1.8-drf3.1
- TOX_ENV=py33-django1.8-drf3.2
- TOX_ENV=py33-django1.8-drf3.3
- TOX_ENV=py34-django1.8-drf2.3
- TOX_ENV=py34-django1.8-drf2.4
- TOX_ENV=py34-django1.8-drf3.0
- TOX_ENV=py34-django1.8-drf3.1
- TOX_ENV=py34-django1.8-drf3.2
- TOX_ENV=py34-django1.8-drf3.3
- TOX_ENV=py34-django1.9-drf3.3
- TOX_ENV=py35-django1.8-drf3.3
- TOX_ENV=py35-django1.9-drf3.3

- TOX_ENV=py27
- TOX_ENV=py35
matrix:
allow_failures:
- env: TOX_ENV=py27-django1.9-drf3.3
- env: TOX_ENV=py34-django1.9-drf3.3
- env: TOX_ENV=py35-django1.9-drf3.3
fast_finish: true

install:
- pip install tox

script:
- tox -e $TOX_ENV
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013, Marc Gibbons
Copyright (c) 2013-2016, Marc Gibbons
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -19,4 +19,4 @@ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81 changes: 29 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@

[![build-status-badge]][build-status]
[![pypi-version]][pypi]
[![license-badge]][license]
[![docs-badge]][docs]

####An API documentation generator for Swagger UI and Django REST Framework

This project is built on the [Django REST Framework Docs](https://github.com/marcgibbons/django-rest-framework-docs) and uses the lovely [Swagger from Wordnik](http://swagger.io) as an interface. This application introspectively generates documentation based on your Django REST Framework API code. Comments are generated in combination from code analysis and comment extraction. Here are some of the features that are documented:
Full documentation: http://marcgibbons.github.io/django-rest-swagger/

* API title - taken from the class name
* Methods allowed
* Serializers & fields in use by a certain method
* Field default values, minimum, maximum, read-only and required attributes
* URL parameters (ie. /product/{id})
* Field `help_text` property is used to create the description from the serializer or model.
**Note:** you are viewing documentation for version 2, using Django REST Framework 3.4+ and CoreAPI. Documentation for previous versions is available [here](http://django-rest-swagger.readthedocs.io/en/0.3.8/).

## Quick start

1. ```pip install django-rest-swagger```
## Installation

1. `pip install django-rest-swagger`

2. Add `rest_framework_swagger` to your `INSTALLED_APPS` setting:

Expand All @@ -29,65 +23,48 @@ This project is built on the [Django REST Framework Docs](https://github.com/mar
)
```

3. Include the rest_framework_swagger URLs to a path of your choice
## 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
2. `SwaggerUIRenderer` generates the Swagger UI and requires the `OpenAPIRenderer`

```python
patterns = ('',
...
url(r'^docs/', include('rest_framework_swagger.urls')),
)
```

for more information, see the [documentation][docs].
### Example: DRF Schema View
```python
from rest_framework_swagger.renderers import OpenAPIRenderer, SwaggerUIRenderer
from rest_framework.decorators import api_view, renderer_classes
from rest_framework import response, schemas

@api_view()
@renderer_classes([SwaggerUIRenderer, OpenAPIRenderer])
def schema_view(request):
generator = schemas.SchemaGenerator(title='Pastebin API')
return response.Response(generator.get_schema(request=request))

```

## Requirements
* Python (2.7, 3.3, 3.4, 3.5)
* Django (1.8)
* Django REST framework (2.3.8+)
* PyYAML (3.10+)
* Django 1.8+
* Django REST framework 3.4+
* Python 2.7, 3.5

## Bugs & Contributions
Please report bugs by opening an issue

Contributions are welcome and are encouraged!

## Special Thanks
Thanks to [BNOTIONS](http://www.bnotions.com) for sponsoring initial development time.

Many thanks to Tom Christie & all the contributors who have developed [Django REST Framework](http://django-rest-framework.org/)

## Contributors
* Marc Gibbons (@marcgibbons)
* Geraldo Andrade (@quein)
* Vítek Pliska (@whit)
* Falk Schuetzenmeister (@postfalk)
* Lukas Hetzenecker (@lukas-hetzenecker)
* David Wolever (@wolever)
* Brian Moe (@bmoe)
* Ian Martin (@aztechian)
* @pzrq
* @jfelectron
* Warnar Boekkooi (@boekkooi)
* Darren Thompson (@WhiteDawn)
* Lukasz Balcerzak (@lukaszb)
* David Newgas (@davidn)
* Bozidar Benko (@bbenko)
* @pySilver


### Django REST Framework Docs contributors:

* Scott Mountenay (@scottmx81)
* @swistakm
* Peter Baumgartner (@ipmb)
* Marlon Bailey (@avinash240)


[build-status-badge]: https://travis-ci.org/marcgibbons/django-rest-swagger.svg?branch=master
[build-status]: https://travis-ci.org/marcgibbons/django-rest-swagger
[pypi-version]: https://img.shields.io/pypi/v/django-rest-swagger.svg
[pypi]: https://pypi.python.org/pypi/django-rest-swagger
[license-badge]: https://img.shields.io/pypi/l/django-rest-swagger.svg
[license]: https://pypi.python.org/pypi/django-rest-swagger/
[docs-badge]: https://readthedocs.io/projects/django-rest-swagger/badge/
[docs]: http://django-rest-swagger.readthedocs.io/
Loading

0 comments on commit 6956ce8

Please sign in to comment.