Skip to content

Error message when given GQL query with out-of-order fragments is super-generic #679

@Woodz

Description

@Woodz

Describe the bug
GraphQL queries that reference fragments defined after their usage silently fail. The UI shows "Loading... Waiting for valid schema and query..." instead of displaying a proper validation error.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://schwer.github.io/graphql-to-openapi/'
  2. Paste a GraphQL query that uses a fragment before it is defined (e.g., use ...MyFragment at the top and define fragment MyFragment on ... below)
  3. See the message "Loading... Waiting for valid schema and query..."
  4. Reorder the fragment definition above its usage and see that the issue resolves

Expected behavior
A clear validation error should be shown if fragment order is required, or the tool should support unordered fragment definitions according to the GraphQL spec.

Screenshots
Not applicable — only the generic "Loading..." message is shown.

Desktop (please complete the following information):

  • OS: macOS Ventura 13.4
  • Browser: Chrome
  • Version: 125.0.6422.113

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context
The current behavior makes it difficult to debug invalid queries. A proper error message would significantly improve the developer experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededjavascriptPull requests that update javascript code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions