From b231948a360396a5b9c1f64369c08aa2a62e9bba Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Tue, 27 Jun 2017 20:22:03 -0700 Subject: [PATCH] GraphQL: Print directives for field declarations (#2317) --- src/printer-graphql.js | 3 ++- .../__snapshots__/jsfmt.spec.js.snap | 11 +++++++++++ tests/graphql_object_type_def/directives.graphql | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/graphql_object_type_def/directives.graphql diff --git a/src/printer-graphql.js b/src/printer-graphql.js index 75cf6f15..4b78035c 100644 --- a/src/printer-graphql.js +++ b/src/printer-graphql.js @@ -254,7 +254,8 @@ function genericPrint(path, options, print) { ) : "", ": ", - path.call(print, "type") + path.call(print, "type"), + printDirectives(path, print, n) ]); } diff --git a/tests/graphql_object_type_def/__snapshots__/jsfmt.spec.js.snap b/tests/graphql_object_type_def/__snapshots__/jsfmt.spec.js.snap index f72dbd64..6ca886fb 100644 --- a/tests/graphql_object_type_def/__snapshots__/jsfmt.spec.js.snap +++ b/tests/graphql_object_type_def/__snapshots__/jsfmt.spec.js.snap @@ -11,6 +11,17 @@ type Video { `; +exports[`directives.graphql 1`] = ` +type PokemonType { + pokemon_type: String @mock(value: "Electric") +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +type PokemonType { + pokemon_type: String @mock(value: "Electric") +} + +`; + exports[`extend.graphql 1`] = ` extend type Feedback { custom_int: Int diff --git a/tests/graphql_object_type_def/directives.graphql b/tests/graphql_object_type_def/directives.graphql new file mode 100644 index 00000000..195b829b --- /dev/null +++ b/tests/graphql_object_type_def/directives.graphql @@ -0,0 +1,3 @@ +type PokemonType { + pokemon_type: String @mock(value: "Electric") +}