Skip to content

Return object information together with validation errors when many=True #9694

Open
@apetryla

Description

@apetryla

I have this use case, when I'm using a DRF serializer with many=True (hundreds of objects). If validation fails on any of these objects, I don't know on which it fails and all I'm getting in the end is field name with too general error message to trace down the failing object.

Was diving into the source code, but it seems that there are various places in which validation error could be raised, various validation error types (including django ones) and also there could be various different validators. So I can't find a single (or two) places where I could reasonably interscept execution and insert the object information, which I need.

Any suggestions on how I could get object info along with error message in the response?

In case this is useful for others and requires reasonable effort, I'd consider contributing it upstream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions