question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue parsing printed GraphQL schema (documentation that ends in `"`)

See original GitHub issue

If a description in a GraphQL schema ends with a quotation mark " then you can no longer parse(printSchema(schema)) - i.e. the printed schema cannot be parsed.

Here’s a small script that reproduces the issue:

const {
  GraphQLObjectType,
  GraphQLSchema,
  GraphQLInt,
  printSchema,
  parse,
} = require("graphql");

const makeSchema = withBadComment =>
  new GraphQLSchema({
    query: new GraphQLObjectType({
      name: "Query",
      fields: {
        hello: {
          type: GraphQLInt,
        },
      },
      description: withBadComment
        ? `Something ending with a "quote"`
        : `Something with "quote" inside.`,
    }),
  });

function test(schema) {
  const schemaString = printSchema(schema);
  console.log(schemaString);

  const parsed = parse(schemaString);
  console.dir(parsed);
}

console.log("Testing good schema");
test(makeSchema(false));

console.log();
console.log();
console.log(
  "********************************************************************************"
);
console.log();
console.log();
console.log("Testing bad schema");
test(makeSchema(true));

GraphQL version: 0.12.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
IvanGoncharovcommented, May 28, 2018

(This is solved in 0.13.2 but we can’t use that because graphql/codemirror-graphql still requires 0.12. )

@benjie Sorry, I completely missed that comment. Just trying to push 14.0.0 forward by cleaning up issues/PRs.

codemirror-graphql support 0.13.2+?

Codemirror depends on graphql-language-service so it should be updated first and I don’t have commit rights to this repo. I will try to make PR this week and ping someone who has commit rights. Feel free to ping me in this issue.

0reactions
benjiecommented, May 28, 2018

Is it possible to either get a fix for this backported to 0.12.x, or have codemirror-graphql support 0.13.2+?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Full Stack Error Handling with GraphQL and Apollo
As a front-end developer, I would like to display rich error feedback in the UI to empower my users to fix their own...
Read more >
Five Common Problems in GraphQL Apps (And How to Fix ...
Problem : Schema Duplication. One of the first things you realize when coding a GraphQL back-end from scratch is that it involves a...
Read more >
GraphQL specification
When using the type system definition language, a document must include at most one schema definition. In this example, a GraphQL schema is...
Read more >
The complete GraphQL Security Guide: Fixing the 13 most ...
The grammar for parsing a GraphQL document is 325 lines. ... it's a repetitive schema but we're also going to address this issue...
Read more >
Custom schema as workaround to plurals issue - GraphQL API
Let's say I have a Parse class called “Media”. ... In the GraphQL guide under Adding Custom Schema there is some documentation, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found