Initial support for GraphQL ObjectTypeDefinition (#2305)

It appears in some files inside of fb codebase
master
Christopher Chedeau 2017-06-27 18:22:04 -07:00 committed by GitHub
parent 189027c7d3
commit f96fe1ea5e
4 changed files with 34 additions and 0 deletions

View File

@ -209,6 +209,21 @@ function genericPrint(path, options, print) {
]);
}
case "ObjectTypeDefinition": {
return concat([
"type ",
path.call(print, "name"),
" = {",
indent(concat([hardline, join(hardline, path.map(print, "fields"))])),
hardline,
"}"
]);
}
case "FieldDefinition": {
return concat([path.call(print, "name"), ": ", path.call(print, "type")]);
}
case "FragmentSpread": {
return concat([
"...",

View File

@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`object_type_def.graphql 1`] = `
type FeedHomeStories {
debug_info: String
query_title: String
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type FeedHomeStories = {
debug_info: String
query_title: String
}
`;

View File

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

View File

@ -0,0 +1,4 @@
type FeedHomeStories {
debug_info: String
query_title: String
}