Open amitv9493 opened 1 month ago
I was able to make it work by adding the following settings in settings.py
for drf-spectacular
SPECTACULAR_SETTINGS = {
'CAMELIZE_NAMES': False,
'POSTPROCESSING_HOOKS': [
'drf_spectacular.contrib.djangorestframework_camel_case.camelize_serializer_fields',
'drf_spectacular.hooks.postprocess_schema_enums'
],
}
wow. Thank you so much @juhanakristian
Hi @juhanakristian
When there is any validation error of a field. It is still showing the camel case name like this .
{
"type": "validation_error",
"errors": [
{
"code": "null",
"detail": "This field may not be null.",
"attr": "client_name"
},
{
"code": "does_not_exist",
"detail": "Invalid pk \"0\" - object does not exist.",
"attr": "property"
}
]
}
Is there any setting that I am missing right now ?
The camelCase is working fine with the GET data, but it is not working with the POST data whe using drf-spectacular.
GET Data:
But When accessing the POST api endpoint in swagger doc. It shows this example data which is confusing the api consumers.
Is there something I am doing wrong? I followed the docs and still nothing works for me