Skip to content
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

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

Closed
benjie opened this issue May 4, 2018 · 5 comments
Closed

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

benjie opened this issue May 4, 2018 · 5 comments

Comments

@benjie
Copy link
Member

benjie commented May 4, 2018

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

@benjie
Copy link
Member Author

benjie commented May 4, 2018

(This is solved in 0.13.2 but we can't use that because https://github.com/graphql/codemirror-graphql still requires 0.12. )

@benjie
Copy link
Member Author

benjie commented May 4, 2018

I believe the fix is in this PR: #1205

@IvanGoncharov
Copy link
Member

@benjie Yes you right it was fixed in #1205
We are working on 14.0.0 that will include this fix.

@benjie
Copy link
Member Author

benjie commented 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+?

@IvanGoncharov
Copy link
Member

(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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants