Skip to content

Skip undefined fragments in depth_limit_validator#1603

Open
Hassad674 wants to merge 1 commit intographql-python:masterfrom
Hassad674:fix/depth-limit-undefined-fragment
Open

Skip undefined fragments in depth_limit_validator#1603
Hassad674 wants to merge 1 commit intographql-python:masterfrom
Hassad674:fix/depth-limit-undefined-fragment

Conversation

@Hassad674
Copy link

Fixes #1538

When a query references an undefined fragment, depth_limit_validator raises a KeyError because it tries to look up the fragment name in the fragments dict. Other validators already catch undefined fragments and report proper errors, so depth_limit_validator should just skip them.

Changed the dict access to use .get() and return depth 0 for undefined fragments. Added a test verifying that undefined fragments don't crash the validator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Depth limit validator key error if fragment undefined

1 participant