diff --git a/src/printer-graphql.js b/src/printer-graphql.js index c7308bf2b..999a55af7 100644 --- a/src/printer-graphql.js +++ b/src/printer-graphql.js @@ -365,6 +365,14 @@ function genericPrint(path, options, print) { ); } + case "ScalarTypeDefinition": { + return concat([ + "scalar ", + path.call(print, "name"), + printDirectives(path, print, n) + ]); + } + case "NonNullType": { return concat([path.call(print, "type"), "!"]); } diff --git a/tests/graphql_scalar/__snapshots__/jsfmt.spec.js.snap b/tests/graphql_scalar/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..47237c309 --- /dev/null +++ b/tests/graphql_scalar/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`scalar.graphql 1`] = ` +scalar Color @deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +scalar Color @deprecated + +`; diff --git a/tests/graphql_scalar/jsfmt.spec.js b/tests/graphql_scalar/jsfmt.spec.js new file mode 100644 index 000000000..335646fb2 --- /dev/null +++ b/tests/graphql_scalar/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "graphql" }); diff --git a/tests/graphql_scalar/scalar.graphql b/tests/graphql_scalar/scalar.graphql new file mode 100644 index 000000000..e999eb8c8 --- /dev/null +++ b/tests/graphql_scalar/scalar.graphql @@ -0,0 +1 @@ +scalar Color @deprecated