lib/graphql/schema/build_from_definition.rb in graphql-1.2.6 vs lib/graphql/schema/build_from_definition.rb in graphql-1.3.0
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module GraphQL
class Schema
module BuildFromDefinition
class << self
def from_definition(definition_string)
@@ -82,10 +83,12 @@
NullResolveType = -> (obj, ctx) {
raise(NotImplementedError, "Generated Schema cannot use Interface or Union types for execution.")
}
+ NullScalarCoerce = ->(val) { val }
+
def build_enum_type(enum_type_definition, type_resolver)
GraphQL::EnumType.define(
name: enum_type_definition.name,
description: enum_type_definition.description,
values: enum_type_definition.values.map do |enum_value_definition|
@@ -111,9 +114,10 @@
def build_scalar_type(scalar_type_definition, type_resolver)
GraphQL::ScalarType.define(
name: scalar_type_definition.name,
description: scalar_type_definition.description,
+ coerce: NullScalarCoerce,
)
end
def build_union_type(union_type_definition, type_resolver)
GraphQL::UnionType.define(