Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bug Fix: Rule Validation Failure with multiple fragments and unknown Graph Types #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

kevin-carroll
Copy link
Member

@kevin-carroll kevin-carroll commented Dec 17, 2023

Fixed issue where:

  • IF: a query has multiple fragment spreads in a field set
  • AND: those fragments could be mergeable
  • AND: one of the fragment's graph type is unresovable
  • THEN: An execution exception would be thrown causing a 500 error instead of triggering rule 5.5.1.2

This query should trigger 5.5.1.2 but was crashing the query (resulting in a hard 500 response)

{
    search{
        ... on Human {
            id
            name
        }

        # Note incorrect casing on Droid
        ... on DRoid {
            id
            name
            __typename
        }    
    }
}
  • The correct validation rule will now be triggered with appropriate messaging with this PR.

  • Also updated the 5.5.1.2 error message for inline fragments to include the failed type name to add additional clarity.

Previous Catastrophic error message:

Response Code: 500
Unknown Internal Server Error

New Corrected Error Response

{
  "errors": [
    {
      "message": "No known graph type was found for the target fragment (Target: 'DRoid').",
      "locations": [
        {
          "line": 7,
          "column": 5
        }
      ],
      "extensions": {
        "code": "INVALID_DOCUMENT",
        "severity": "CRITICAL",
        "metaData": {
          "Rule": "5.5.1.2",
          "RuleReference": "https://spec.graphql.org/October2021/#sec-Fragment-Spread-Type-Existence"
        }
      }
    }
  ]
}

@kevin-carroll kevin-carroll added the bug Something isn't working label Dec 17, 2023
@kevin-carroll kevin-carroll self-assigned this Dec 17, 2023
@kevin-carroll kevin-carroll merged commit 3c88cfd into master Dec 20, 2023
@kevin-carroll kevin-carroll deleted the bug/error-for-spread-type-names branch December 20, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.