Depth limit validator key error if fragment undefined
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- graphql, python
- Domain
- api, backend-api-design
Research direction
Inspect graphene/validation/depth_limit.py around line 148, then reproduce the undefined-fragment query with depth_limit_validator configured on GraphQLView. Ensure this case produces the standard unknown-fragment validation response instead of a KeyError or 500 error.
Written by the indexing model from the issue text.
Description
Current behaviour:
When using the depth_limit_validator (docs), an invalid query can lead to a KeyError being thrown (from here), which usually results in the API returning a 500 server error.
To reproduce:
- Add the
depth_limit_validatorto thevalidation_rulesin yourGraphQLView. - Execute a query with an undefined fragment, i.e. something like:
query {
validQuery {
validField
...undefinedFragment
}
}
Expected behaviour:
A standard validation error response, like:
{
"errors": [
{
"message": "Unknown fragment 'undefinedFragment'.",
"locations": [
{
"line": x,
"column": y
}
]
}
]
}
Since this is something that's caught by the standard validators, depth_limit_validator should probably just skip such errors. Or, do whatever the other validators do when they hit an "unrelated" error.
Environment:
- Version: 3.3
- Platform: n/a
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 818
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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 graphql-python/graphene
-
Tutorial mistakes Open🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
graphql-python/graphene#1389 · 5 comments · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
graphql-python/graphene#1606 ·
-
Python 3.14 support Open✨ enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
graphql-python/graphene#1601 · 2 comments ·
-
✨ enhancement
Difficulty 4/5 3-5 days Newbie friendliness 42/100
graphql-python/graphene#1600 ·
-
🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
graphql-python/graphene#1593 ·
All issues in graphql-python/graphene
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·