GraphQL: Implement schema (#2316)
parent
019beb54e5
commit
45c8e40d8a
|
@ -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 ",
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, { parser: "graphql" });
|
|
@ -0,0 +1,5 @@
|
|||
schema {
|
||||
query: Root
|
||||
mutation: Mutation
|
||||
subscription: Subscription
|
||||
}
|
Loading…
Reference in New Issue