lib/graphql/schema/scalar.rb in graphql-1.8.0.pre10 vs lib/graphql/schema/scalar.rb in graphql-1.8.0.pre11

- old
+ new

@@ -3,25 +3,32 @@ class Schema class Scalar < GraphQL::Schema::Member extend GraphQL::Schema::Member::AcceptsDefinition class << self + extend Forwardable + def_delegators :graphql_definition, :coerce_isolated_input, :coerce_isolated_result + def coerce_input(val, ctx) - raise NotImplementedError, "#{self.name}.coerce_input(val, ctx) must prepare GraphQL input (#{val.inspect}) for Ruby processing" + val end def coerce_result(val, ctx) - raise NotImplementedError, "#{self.name}.coerce_result(val, ctx) must prepare Ruby value (#{val.inspect}) for GraphQL response" + val end def to_graphql type_defn = GraphQL::ScalarType.new type_defn.name = graphql_name type_defn.description = description type_defn.coerce_result = method(:coerce_result) type_defn.coerce_input = method(:coerce_input) type_defn.metadata[:type_class] = self type_defn + end + + def kind + GraphQL::TypeKinds::SCALAR end end end end end