GraphQL: Print arguments for FieldDefinition (#2314)

This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-06-27 19:49:59 -07:00
1 parent bbf8f76823
commit 14caabd635
3 files changed
+37 -1

No files matched your search

+23 -1
View File
@@ -233,7 +233,29 @@ function genericPrint(path, options, print) {
}
case "FieldDefinition": {
return concat([path.call(print, "name"), ": ", path.call(print, "type")]);
return concat([
path.call(print, "name"),
n.arguments.length > 0
? group(
concat([
"(",
indent(
concat([
softline,
join(
concat([ifBreak("", ", "), softline]),
path.map(print, "arguments")
)
])
),
softline,
")"
])
)
: "",
": ",
path.call(print, "type")
]);
}
case "DirectiveDefinition": {
@@ -1,5 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`arguments.graphql 1`] = `
type Video {
playable_url(quality: String, preferred: String): Url
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type Video {
playable_url(quality: String, preferred: String): Url
}
`;
exports[`extend.graphql 1`] = `
extend type Feedback {
custom_int: Int
@@ -0,0 +1,3 @@
type Video {
playable_url(quality: String, preferred: String): Url
}