GraphQL: Implement schema (#2316)

master
Christopher Chedeau 2017-06-27 20:15:55 -07:00 committed by GitHub
parent 019beb54e5
commit 45c8e40d8a
4 changed files with 48 additions and 0 deletions

View File

@ -334,6 +334,32 @@ function genericPrint(path, options, print) {
]);
}
case "SchemaDefinition": {
return concat([
"schema",
printDirectives(path, print, n),
" {",
n.operationTypes.length > 0
? indent(
concat([
hardline,
join(hardline, path.map(print, "operationTypes"))
])
)
: "",
hardline,
"}"
]);
}
case "OperationTypeDefinition": {
return concat([
path.call(print, "operation"),
": ",
path.call(print, "type")
]);
}
case "InterfaceTypeDefinition": {
return concat([
"interface ",

View File

@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`schema.graphql 1`] = `
schema {
query: Root
mutation: Mutation
subscription: Subscription
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
schema {
query: Root
mutation: Mutation
subscription: Subscription
}
`;

View File

@ -0,0 +1 @@
run_spec(__dirname, { parser: "graphql" });

View File

@ -0,0 +1,5 @@
schema {
query: Root
mutation: Mutation
subscription: Subscription
}