An adapter to use swagger-ui with django-tastypie
Project description
WARNING: This package is ultra young and still needs a lot of work
Synopsis
django-tastypie-swagger is a small adapter library to construct Swagger documentation from Tastypie resources.
This package provides two things:
An embedded instance of Swagger UI to point a URL to.
Automatic Resource Listing and API Declaration generation that is consumed by #1
Usage
Install package:
pip install django-tastypie-swagger
Add to INSTALLED_APPS:
INSTALLED_APPS = [ ... 'tastypie_swagger', ... ]
Define TASTYPIE_SWAGGER_API_MODULE in your settings. It should be a python path to your instance of tastypie.api.Api:
TASTYPIE_SWAGGER_API_MODULE = 'mainsite.urls.api'
Include in your urlconf with namespace tastypie_swagger:
urlpatterns = patterns('', ... url(r'api/doc/', include('tastypie_swagger.urls', namespace='tastypie_swagger')), ... )
Swagger documentation will be served up at the URL you configured.
Detecting required fields
Tastypie 0.9.11 ModelResource fields do not respect the blank attribute on django model fields, which this library depends on to determine if a field is required or not.
You can use this ModelResource subclass as a workaround to this issue.
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
Hashes for django-tastypie-swagger-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c095b4a1cb9167cae0ae33e7b0cf5b291931fb56648eb9c48275562b78e6879 |
|
MD5 | 1cf0c9163c30b228eae346bc7c9342eb |
|
BLAKE2b-256 | 3a7a9111200e9e76766cda0f8735d27f63e35f22bb5fc69b2b89b3282abf0cd8 |