Skip to content

Unable to use block string literals #1026

@danielrearden

Description

@danielrearden

This issue pertains to the following package(s):

  • GraphQL Playground - Electron App
  • GraphQL Playground HTML
  • GraphQL Playground
  • GraphQL Playground Express Middleware
  • GraphQL Playground Hapi Middleware
  • GraphQL Playground Koa Middleware
  • GraphQL Playground Lambda Middleware

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

MacOS 10.13.6

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

apollo-server-core uses ^1.6.6 but I believe this issue is relevant to all current versions

What is the expected behavior?

GraphQL.js added support for block strings beginning with version 0.12.0. Block strings may be used anywhere regular string literals are used and provide a clean way to provide multi-line, unescaped input. I should be able to submit queries that use block strings in GraphQL Playground. Block strings should not result in syntax errors.

What is the actual behavior?

Block strings result in a syntax error because the version of GraphQL being used does not understand how to parse them. I could live with the syntax error highlighting, but because Playground also prevents you from submitting an syntactically invalid query, block strings effectively make your queries untestable unless you just use the copy curl feature.

What steps may we take to reproduce the behavior?

Enter the following introspection query into any Playground instance:

query {
  __type(name:"""Query""") {
    name
    description
  }
}

Screen Shot 2019-05-11 at 4 08 35 PM

Bumping the graphql dependency up to 0.12.0 should resolve this issue, although I'm not sure if there are any breaking changes that would cause other issues with Playground.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions