Closed allynt closed 4 years ago
What you suggest will not be possible w/out a lot of hacky code. But I could do the following:
All error responses will have the following structure:
{ <field_name>: [<error1>, <error2>, <errorN>]}
and in the case of errors that don't quite map to a single field:
{ "non-field-errors": [<error1>, <error2>, <errorN>]}
Note, that I can replace non-field-errors
w/ any old string (I had considered using detail
)
I guess my ideal structure would be:
{
error: {
<field_name>: [<error1>, <error2>],
...
}
}
and, for non-field-errors
:
{
error: {
details: [<error1>, <error2>]
}
}
This would give us a near unified structure, while allowing for differences in the payload. If this isn't possible, what you suggest above seems fine too.
{
"errors": {
<field_name>: [<error1>, <error2>],
"non_field_errors": [<error1>, <error2>]
},
"anything_else": "in_the_payload"
}
done in these 2 commits:
2d4d7829ba9f6843fd805f8d4d06c0752b4056b5:
PermissionDenied
error rather than some sort of clever method_decorator
)rest_unused
and rest_disabled
endpoints34233a10bd5314c48c0c8e53c62d3b8b44ab77b1:
serializer/validation
errors to consolidate errors; used the new ConsolidatedErrorsSerializerMixin
from django-astrosat-core
from Slack:
@marksmall:
@allynt: