diff --git a/src/graphql_builtins.erl b/src/graphql_builtins.erl index 33ab83f..d3ca6b7 100644 --- a/src/graphql_builtins.erl +++ b/src/graphql_builtins.erl @@ -16,7 +16,7 @@ standard_types_inject() -> id => 'Int', description => <<"Integers in the range ±2^53. The GraphQL standard only allows for 32-bit signed integers, but we can support up to the larger range."/utf8>> }}, Bool = {scalar, #{ - id => 'Bool', + id => 'Boolean', description => <<"Boolean values, either given as the *true* and *false* values of JSON, or as the strings \"true\" and \"false\"."/utf8>> }}, ID = {scalar, #{ id => 'ID', @@ -36,7 +36,7 @@ standard_directives_inject() -> locations => ['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], resolve_module => graphql_directives, args => #{ <<"if">> => #{ - type => 'Bool', + type => 'Boolean', default => false, description => <<"Wether or not the item should be skipped">> }} }}, @@ -46,7 +46,7 @@ standard_directives_inject() -> locations => ['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], resolve_module => graphql_directives, args => #{ <<"if">> => #{ - type => 'Bool', + type => 'Boolean', default => false, description => <<"Wether or not the item should be included">> }} }}, diff --git a/src/graphql_introspection.erl b/src/graphql_introspection.erl index bfc119e..df83e54 100644 --- a/src/graphql_introspection.erl +++ b/src/graphql_introspection.erl @@ -262,7 +262,7 @@ inject() -> description => "The fields in the object/interface", args => #{ includeDeprecated => #{ - type => 'Bool', + type => 'Boolean', description => "Should deprecated fields be included or not", default => false }}}, @@ -282,7 +282,7 @@ inject() -> description => "The possible values of an Enum", args => #{ includeDeprecated => #{ - type => 'Bool', + type => 'Boolean', description => "Should deprecated fields be included or not", default => false }}}, @@ -313,7 +313,7 @@ inject() -> type => '__Type', description => "The type of the given field" }, isDeprecated => #{ - type => 'Bool!', + type => 'Boolean!', description => "True if the field is deprecated, false otherwise" }, deprecationReason => #{ type => 'String', @@ -349,7 +349,7 @@ inject() -> type => 'String', description => "The description of the value" }, isDeprecated => #{ - type => 'Bool!', + type => 'Boolean!', description => "True if this is a deprecated field" }, deprecationReason => #{ type => 'String', @@ -384,13 +384,13 @@ inject() -> type => {non_null, ['__DirectiveLocation!']}, description => "Where the directives can be used" }, onOperation => #{ - type => 'Bool', + type => 'Boolean', description => "Not documented yet" }, onFragment => #{ - type => 'Bool', + type => 'Boolean', description => "Not documented yet" }, onField => #{ - type => 'Bool', + type => 'Boolean', description => "Not documented yet" }, args => #{ type => {non_null, ['__InputValue!']}, @@ -430,7 +430,7 @@ directive(Kind) -> {<<"skip">>, <<"exclude a selection on a conditional variable">>} end, - {ok, Bool} = render_type(<<"Bool">>), + {ok, Bool} = render_type(<<"Boolean">>), #{ <<"name">> => Name, diff --git a/src/graphql_parser.yrl b/src/graphql_parser.yrl index d07bb02..e19f332 100644 --- a/src/graphql_parser.yrl +++ b/src/graphql_parser.yrl @@ -453,10 +453,10 @@ g_ty({name, _, <<"Int">>}) -> {scalar, <<"Int">>}; g_ty({name, _, <<"int">>}) -> {scalar, <<"Int">>}; g_ty({name, _, <<"float">>}) -> {scalar, <<"Float">>}; g_ty({name, _, <<"Float">>}) -> {scalar, <<"Float">>}; -g_ty({name, _, <<"bool">>}) -> {scalar, <<"Bool">>}; -g_ty({name, _, <<"Bool">>}) -> {scalar, <<"Bool">>}; -g_ty({name, _, <<"boolean">>}) -> {scalar, <<"Bool">>}; -g_ty({name, _, <<"Boolean">>}) -> {scalar, <<"Bool">>}; +g_ty({name, _, <<"bool">>}) -> {scalar, <<"Boolean">>}; +g_ty({name, _, <<"Bool">>}) -> {scalar, <<"Boolean">>}; +g_ty({name, _, <<"boolean">>}) -> {scalar, <<"Boolean">>}; +g_ty({name, _, <<"Boolean">>}) -> {scalar, <<"Boolean">>}; g_ty({name, _, <<"id">>}) -> {scalar, <<"ID">>}; g_ty({name, _, <<"Id">>}) -> {scalar, <<"ID">>}; g_ty({name, _, <<"ID">>}) -> {scalar, <<"ID">>}; diff --git a/src/graphql_scalar_bool_coerce.erl b/src/graphql_scalar_bool_coerce.erl index c3f67d9..27578c0 100644 --- a/src/graphql_scalar_bool_coerce.erl +++ b/src/graphql_scalar_bool_coerce.erl @@ -6,10 +6,10 @@ input(_, true) -> {ok, true}; input(_, false) -> {ok, false}; input(_, _) -> {error, not_bool}. -output(<<"Bool">>, true) -> {ok, true}; -output(<<"Bool">>, <<"true">>) -> {ok, true}; -output(<<"Bool">>, false) -> {ok, false}; -output(<<"Bool">>, <<"false">>) -> {ok, false}; -output(<<"Bool">>, 0) -> {ok, false}; -output(<<"Bool">>, X) when is_integer(X) -> {ok, true}; +output(<<"Boolean">>, true) -> {ok, true}; +output(<<"Boolean">>, <<"true">>) -> {ok, true}; +output(<<"Boolean">>, false) -> {ok, false}; +output(<<"Boolean">>, <<"false">>) -> {ok, false}; +output(<<"Boolean">>, 0) -> {ok, false}; +output(<<"Boolean">>, X) when is_integer(X) -> {ok, true}; output(_,_) -> {error, not_coercible}. diff --git a/src/graphql_schema_canonicalize.erl b/src/graphql_schema_canonicalize.erl index 78478bb..ec59d38 100644 --- a/src/graphql_schema_canonicalize.erl +++ b/src/graphql_schema_canonicalize.erl @@ -193,7 +193,7 @@ scalar_resolve(#{ resolve_module := ModuleResolver }) scalar_resolve(#{ id := 'ID'}) -> graphql_scalar_binary_coerce; scalar_resolve(#{ id := 'String'}) -> graphql_scalar_binary_coerce; -scalar_resolve(#{ id := 'Bool'}) -> graphql_scalar_bool_coerce; +scalar_resolve(#{ id := 'Boolean'}) -> graphql_scalar_bool_coerce; scalar_resolve(#{ id := 'Int'}) -> graphql_scalar_integer_coerce; scalar_resolve(#{ id := 'Float'}) -> graphql_scalar_float_coerce; scalar_resolve(_) -> graphql_enum_coerce. diff --git a/test/blog.erl b/test/blog.erl index c19739c..408365c 100644 --- a/test/blog.erl +++ b/test/blog.erl @@ -55,7 +55,7 @@ inject() -> type => 'ID!', description => "The ID of the article" }, isPublished => #{ - type => 'Bool', + type => 'Boolean', description => "True is the article has been published"}, author => #{ type => 'Author', diff --git a/test/dungeon_SUITE_data/dungeon_schema.graphql b/test/dungeon_SUITE_data/dungeon_schema.graphql index f9c1696..5c4eb86 100644 --- a/test/dungeon_SUITE_data/dungeon_schema.graphql +++ b/test/dungeon_SUITE_data/dungeon_schema.graphql @@ -47,7 +47,7 @@ type Monster implements Node { hitpoints : Int! inventory : [Thing] hp : Int! - mood(fail: Bool @private) : Mood @private + mood(fail: Boolean @private) : Mood @private plushFactor : Float! spikyness : Float stats( diff --git a/test/dungeon_SUITE_data/query.graphql b/test/dungeon_SUITE_data/query.graphql index ffab2c1..0c36c29 100644 --- a/test/dungeon_SUITE_data/query.graphql +++ b/test/dungeon_SUITE_data/query.graphql @@ -76,7 +76,7 @@ query GoblinQuery($id : Id! = "bW9uc3Rlcjox") { } } -query GoblinQueryDirectives($id : Id! = "bW9uc3Rlcjox", $fat : Bool!) { +query GoblinQueryDirectives($id : Id! = "bW9uc3Rlcjox", $fat : Boolean!) { goblin: monster(id: $id) { id name @include(if: $fat) @@ -84,7 +84,7 @@ query GoblinQueryDirectives($id : Id! = "bW9uc3Rlcjox", $fat : Bool!) { } } -query GoblinQueryDirectivesInline($id : Id! = "bW9uc3Rlcjox", $fat : Bool!) { +query GoblinQueryDirectivesInline($id : Id! = "bW9uc3Rlcjox", $fat : Boolean!) { goblin: monster(id: $id) { id ... @include(if: $fat) { diff --git a/test/schema_pet.erl b/test/schema_pet.erl index 99c5e07..06fdaac 100644 --- a/test/schema_pet.erl +++ b/test/schema_pet.erl @@ -8,7 +8,7 @@ inject() -> description => ["Input Object for testing uniqueness"], fields => #{ field => #{ - type => 'Bool!', + type => 'Boolean!', description => "A bool field" }}}}, ok = graphql:insert_schema_definition(TestField), DogCommand = {enum, #{ @@ -46,7 +46,7 @@ inject() -> nickname => #{ type => 'String', description => "Nickname of the dog, if any" }, barkVolume => #{ type => 'Int', description => "Bark volume in dB" }, doesKnowCommand => #{ - type => 'Bool!', + type => 'Boolean!', description => "Does the dog know a specific command?", args => #{ dogCommand => #{ @@ -54,11 +54,11 @@ inject() -> description => "The dog command we want to ask for" }} }, isHouseTrained => #{ - type => 'Bool!', + type => 'Boolean!', description => "Is the dog house trained", args => #{ atOtherHomes => #{ - type => 'Bool', + type => 'Boolean', description => "Is the query including other homes?" }} }, owner => #{ @@ -108,7 +108,7 @@ inject() -> nickname => #{ type => 'String', description => "The nickname of the cat, if any" }, doesKnowCommand => #{ - type => 'Bool!', + type => 'Boolean!', description => "Does the cat know of a specific command type", args => #{ catCommand => #{ @@ -157,10 +157,10 @@ inject() -> y => #{ type => 'Int!', description => "The Y arg"} }}, booleanArgField => #{ - type => 'Bool', + type => 'Boolean', description => "Test of a boolean arg field", args => #{ - booleanArg => #{ type => 'Bool', description => "The Bool Arg" } + booleanArg => #{ type => 'Boolean', description => "The Bool Arg" } }}, floatArgField => #{ type => 'Float', @@ -175,18 +175,18 @@ inject() -> intArg => #{type => 'Int', description => "The Int Arg" } }}, nonNullBooleanArgField => #{ - type => 'Bool!', + type => 'Boolean!', description => "Test of non-null args", args => #{ nonNullBooleanArg => #{ - type => 'Bool!', + type => 'Boolean!', description => "The non-null bool arg" } }}, booleanListArgField => #{ - type => ['Bool'], + type => ['Boolean'], description => "Test lists of bools", args => #{ - booleanListArg => #{ type => {non_null, ['Bool']}, description => "The list of bools"} + booleanListArg => #{ type => {non_null, ['Boolean']}, description => "The list of bools"} }} }}}, ok = graphql:insert_schema_definition(Arguments), @@ -198,7 +198,7 @@ inject() -> fields => #{ arguments => #{ type => 'Arguments', description => "More complicated Argument cases" }, field => - #{ type => 'Bool', + #{ type => 'Boolean', description => "Test for input object uniqueness", args => #{ arg => #{