Skip to content

SchemaFetcher.ts: Wrong Evaluation of Successfully Fetched Schema #864

@pavelkryl

Description

@pavelkryl

This issue pertains to the following package(s):

  • [x ] GraphQL Playground HTML

What OS and OS version are you experiencing the issue(s) on?

Linux + Google Chrome

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

current (commit ec0b3fd)

What is the expected behavior?

Evaluate empty schemaData.errors array as false (no errors).

What is the actual behavior?

wrong check on lines 74 - 76:

if (schemaData && (schemaData.errors || !schemaData.data)) {
            throw new Error(JSON.stringify(schemaData, null, 2))
}

If there is an empty errors array, this still raises an exception.

What steps may we take to reproduce the behavior?

I got the result when parsing the attached introspection query result.

schema.json.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions