Add support for GraphQL TypeExtensionDefinition (#2306)

master
Christopher Chedeau 2017-06-27 18:26:43 -07:00 committed by GitHub
parent f96fe1ea5e
commit af309e3acd
3 changed files with 21 additions and 1 deletions

View File

@ -209,11 +209,17 @@ function genericPrint(path, options, print) {
]);
}
case "TypeExtensionDefinition": {
return concat(["extend ", path.call(print, "definition")]);
}
case "ObjectTypeDefinition": {
const parent = path.getParentNode();
return concat([
"type ",
path.call(print, "name"),
" = {",
parent.kind === "TypeExtensionDefinition" ? "" : " =",
" {",
indent(concat([hardline, join(hardline, path.map(print, "fields"))])),
hardline,
"}"

View File

@ -1,5 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`extend.graphql 1`] = `
extend type Feedback {
custom_int: Int
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extend type Feedback {
custom_int: Int
}
`;
exports[`object_type_def.graphql 1`] = `
type FeedHomeStories {
debug_info: String

View File

@ -0,0 +1,3 @@
extend type Feedback {
custom_int: Int
}