django-json-api / django-rest-framework-json-api

JSON:API support for Django REST framework
https://django-rest-framework-json-api.readthedocs.org/
BSD 2-Clause "Simplified" License
1.19k stars 297 forks source link

Add information on how to integrate JSON API with with DRF built-in coreapi documentation #638

Closed arielpontes closed 5 years ago

arielpontes commented 5 years ago

I followed the instructions in the DRF docs to generate documentation for my project but it doesn't show the correct expected payload format in PATCH/POST endpoints. It shows the following standard messages in all endpoints:

The request body should be a "application/x-www-form-urlencoded" encoded object, containing the following items.

And then it shows a list of the attributes that are supported, but there is no mention of the JSON API format, which should be:

{
    "data": {
        "type": "ResourceType",
        "attributes": {
            ...
        }
    }
}

How can I customize the DRF documentation so that it shows the proper format and content-type expected?

n2ygk commented 5 years ago

DRF is deprecating coreapi and replacing it with openapi. I’ve been working on prototyping openapi support for DJA and have had to submit a number of PRs to DRF to enable this. I’m close to being ready to share this for review and hope to be able to do so soon.

On Thu, May 23, 2019 at 2:53 AM Ariel Pontes notifications@github.com wrote:

I followed the instructions in the DRF docs to generate documentation for my project but it doesn't show the correct expected payload format in PATCH/POST endpoints. It shows the following standard messages in all endpoints:

The request body should be a "application/x-www-form-urlencoded" encoded object, containing the following items.

And then it shows a list of the attributes that are supported, but there is no mention of the JSON API format, which should be:

{ "data": { "type": "ResourceType", "attributes": { ... } } }

How can I customize the DRF documentation so that it shows the proper format and content-type expected?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/django-json-api/django-rest-framework-json-api/issues/638?email_source=notifications&email_token=ABBHS577GFTLRXQVIUGP7VDPWY5OLA5CNFSM4HO2ON6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GVL72FA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBHS55YDD5ZUIYEQH3B7JDPWY5OLANCNFSM4HO2ON6A .

n2ygk commented 5 years ago

@arielpontes Here's a preview of what I've been working on: https://columbia-it-django-jsonapi-training.readthedocs.io/en/latest/documenting-api.html

sliverc commented 5 years ago

@n2ygk Could we close this issue in favour of #604?

n2ygk commented 5 years ago

Closing as this is covered by #604