Handle deeply nested validation errors
Nobody has claimed this yet.
- #31 by @MichaelJRM — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
The issue does not name a file or test. Start by tracing the validation-error formatting path that handles SUPPORT_MULTIPLE_EXCEPTIONS and nested dictionaries and lists. Reproduce the supplied structure, then verify that the output flattens nested errors into the stated attributes, codes, details, and list entries.
Written by the indexing model from the issue text.
Description
Say we have the following ValidationError with SUPPORT_MULTIPLE_EXCEPTIONS = True
{
"parent_1": {
"l1_attr_3": [
[
ErrorDetail(
string="This field may not be blank.", code="blank"
),
]
],
},
"parent_2": [
[
ErrorDetail(string="This field may not be blank.", code="blank"),
]
],
"parent_3": [
{
"l1_attr_1": [
ErrorDetail(
string="This field may not be blank.", code="blank"
),
],
"l1_attr_2": [
ErrorDetail(
string="This field may not be blank.", code="blank"
),
],
},
{
"l1_attr_1": [
ErrorDetail(
string="This field may not be blank.", code="blank"
),
],
},
],
}
The expected result is
{
"type": "multiple",
"code": "multiple",
"detail": "Multiple exceptions occurred. Please check list for details.",
"attr": None,
"list": [
{
"type": "validation_error",
"code": "blank",
"detail": "This field may not be blank.",
"attr": "parent_1__l1_attr_3__0",
},
{
"type": "validation_error",
"code": "blank",
"detail": "This field may not be blank.",
"attr": "parent_2__0",
},
{
"type": "validation_error",
"code": "blank",
"detail": "This field may not be blank.",
"attr": "parent_3__0__l1_attr_1",
},
{
"type": "validation_error",
"code": "blank",
"detail": "This field may not be blank.",
"attr": "parent_3__0__l1_attr_2",
},
{
"type": "validation_error",
"code": "blank",
"detail": "This field may not be blank.",
"attr": "parent_3__1__l1_attr_1",
},
],
}
Instead we get this
{
"type": "multiple",
"code": "multiple",
"detail": "Multiple exceptions ocurred. Please check list for details.",
"attr": None,
"list": [
{
"type": "validation_error",
"code": "['blank']",
"detail": "[ErrorDetail(string='This field may not be blank.', code='blank')]",
"attr": "parent_1__l1_attr_3",
},
{
"type": "validation_error",
"code": "['blank']",
"detail": "[ErrorDetail(string='This field may not be blank.', code='blank')]",
"attr": "parent_2",
},
{
"type": "validation_error",
"code": "{'l1_attr_1': ['blank'], 'l1_attr_2': ['blank']}",
"detail": "{'l1_attr_1': [ErrorDetail(string='This field may not be blank.', code='blank')], 'l1_attr_2': [ErrorDetail(string='This field may not be blank.', code='blank')]}",
"attr": "parent_3",
},
],
}
- Dominant language
- Python
- Stars
- 68
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PostHog/drf-exceptions-hog
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
PostHog/drf-exceptions-hog#32 · 3 reactions ·
-
Coverage reportOpenenhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in PostHog/drf-exceptions-hog
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Install the skills as a Claude Code pluginPossibly taken @ruban-24 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
FAIRmat-NFDI/pynxtools#874 ·
-
Eval: PublicationOpendata
Difficulty 2/5 1-3 hours Newbie friendliness 66/100