Usage django-rest-framework-json-apiI can create API endpoints that work as described in the documentation. Trying to provide API documentation with is django-rest-swaggernot so simple.
1: Swagger uses media_type = 'application/json'which is not supported in the JSON API. To get around this, I created a second rendering class ( renderer_classes), which subclasses the JSON API JSONRendererand forces the media type.
The endpoint now supports application/jsonboth application/vnd.api+json, and swagger is pleased to display the JSON API in the document structure. Recognizing that the generated curl requests do not have a standard JSON API header.
2: Swagger has the same problem with the parser. While work on Problem 1 does work, a secondary problem arises. Swagger provides a flat dictionary of field names that is not a JSON API and is ultimately requested by DRF.
Is it possible to understand the JSON API? Swagger does not currently work for PUT or POST.
djangorestframework-jsonapi==2.2.0
djangorestframework==3.5.4
Django==1.11.2
coreapi==2.3.1
python 3.6
source
share