-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels