Module: GraphqlTypes

Defined in:
lib/graphql_types.rb,
lib/graphql_types/version.rb

Constant Summary collapse

AnyType =
GraphQL::ScalarType.define do
  name "Any"
  description "A dynamic-typed object"

  coerce_input ->(x, _context) { x }
  coerce_result ->(x, _context) { x }
end
JsonType =
GraphQL::ScalarType.define do
  name "JSON"
  description "A dynamic-typed object encoded in JSON (deprecated)"

  coerce_input ->(x, _context) { JSON.parse(x) }
  coerce_result ->(x, _context) { JSON.dump(x) }
end
DateType =
GraphQL::ScalarType.define do
  # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
  name "Date"
  description "A single moment of a time"

  coerce_input ->(x, _context) { Time.parse(x) }
  coerce_result ->(x, _context) { x.iso8601 }
end
BigIntType =
GraphQL::ScalarType.define do
  # https://github.com/tc39/proposal-bigint
  name "BigInt"
  description "An arbitrary precision integer"

  coerce_input ->(x, _context) { x.to_i }
  coerce_result ->(x, _context) { x.to_s }
end
VERSION =
"0.3.0"