Open JPGarCar opened 6 hours ago
Hi, the TokenRefresh
is perfectly fine like that. It is just that your generated client is buggy, which is not that uncommon.
Many code generators have trouble with this aspect, which is why we generally recommend enabling component split ('COMPONENT_SPLIT_REQUEST': True
) globally for schemas that are to be used with code generators. Usually this will produce vastly better generated code.
https://drf-spectacular.readthedocs.io/en/latest/client_generation.html
Describe the bug The schema yml file created by running the spectacular CLI is using the same component for the requestBody and response when each one should be different as they each have different values.
For example, SimpleJWT's
token/refresh
endpoint only needs the "refresh" value, and the response should only include the"access"
value.However, the created schema creates the following Component Schema:
and both the requestBody and response reference that component schema.
This leads to my API Client to think I need both the access and refresh values when calling this endpoint.
To Reproduce
DRF and SimpleJWT are both installed and in use.
This is the command I used to create the yml file:
python manage.py spectacular --color --file schema.yml
My Spectacular Settings:
My REST Framework Settings:
Expected behavior The schema should use two different components, one for the requestBody and one for the response.
Thank you in advance :).