drf-standardized-errors
drf-standardized-errors copied to clipboard
Not working with https://github.com/vbabiy/djangorestframework-camel-case
I am using the https://github.com/vbabiy/djangorestframework-camel-case in order to format the response to camel case. The problem is when there is any Error is raised, the fields are rendered as snake case. Here are the example:
When resource is successfully created I get this response:
{
"createdAt": "2024-07-28T13:58:50.062565Z",
"updatedAt": "2024-07-28T13:58:50.062691Z",
"clientName": "string",
"clientPhone": "string",
"clientEmail": "[email protected]",
"taskTime": "2024-07-28T13:58:13.054000Z",
"notes": "string",
"paymentAmount": 20,
"paymentMethod": "ONLINE",{
"type": "validation_error",
"errors": [
{
"code": "required",
"detail": "This field is required.",
"attr": "client_name"
}
]
}
"isCompleted": true,
"jobType": "APPLY",
"jobDeadline": "2024-07-28T13:58:13.054000Z",
"applyDeadline": "2024-07-28T13:58:13.054000Z",
"brokerage": "MY-BROKERAGE",
"showClientPhoneNumber": true,
"accessInformation": "string",
"createdBy": null,
"property": 1,
"assignedTo": null
}
But when an error is raised, I am getting attr rendered in snake case due to which api developers are getting too much confused :
{
"type": "validation_error",
"errors": [
{
"code": "required",
"detail": "This field is required.",
"attr": "client_name"
}
]
}
Hi @amitv9493, djangorestframework-camel-case is not supported out of the box, still check #59, it might be helpful to solve your issue