Support graphql NonNullType (#2060)

master
Tim Griesser 2017-06-08 12:20:41 -04:00 committed by Christopher Chedeau
parent 126727380d
commit e9045e4bcf
3 changed files with 16 additions and 6 deletions

View File

@ -243,6 +243,13 @@ function genericPrint(path, options, print) {
);
}
case "NonNullType": {
return concat([
path.call(print, "type"),
"!"
]);
}
default:
throw new Error("unknown graphql type: " + JSON.stringify(n.kind));
}

View File

@ -1,16 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`variable_definitions.graphql 1`] = `
query short($foo:ComplexType, $site : Site = MOBILE) {
query short($foo:ComplexType, $site : Site = MOBILE, $nonNull: Int!) {
hello
}
query long($foo: ComplexType, $site: Float = 124241.12312,
$bar: String = "Long string here", $arg: String = "Hello world!",,,,) {
$bar: String = "Long string here", $arg: String = "Hello world!",,,,,
$nonNull: String!) {
hello
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
query short($foo: ComplexType, $site: Site = MOBILE) {
query short($foo: ComplexType, $site: Site = MOBILE, $nonNull: Int!) {
hello
}
@ -18,7 +19,8 @@ query long(
$foo: ComplexType,
$site: Float = 124241.12312,
$bar: String = "Long string here",
$arg: String = "Hello world!"
$arg: String = "Hello world!",
$nonNull: String!
) {
hello
}

View File

@ -1,8 +1,9 @@
query short($foo:ComplexType, $site : Site = MOBILE) {
query short($foo:ComplexType, $site : Site = MOBILE, $nonNull: Int!) {
hello
}
query long($foo: ComplexType, $site: Float = 124241.12312,
$bar: String = "Long string here", $arg: String = "Hello world!",,,,) {
$bar: String = "Long string here", $arg: String = "Hello world!",,,,,
$nonNull: String!) {
hello
}