Sha256: cd0b37111f13f457615c4de61286b7daf3b04464d44e166b250a10839d924864

Contents?: true

Size: 654 Bytes

Versions: 6

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true
GraphQL::ID_TYPE = GraphQL::ScalarType.define do
  name "ID"
  description "Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"VXNlci0xMA==\"`) or integer (such as `4`) input value will be accepted as an ID."

  coerce_result ->(value) { value.to_s }
  coerce_input ->(value) {
    case value
    when String, Fixnum, Bignum
      value.to_s
    else
      nil
    end
  }
  default_scalar true
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-1.4.5 lib/graphql/id_type.rb
graphql-1.4.4 lib/graphql/id_type.rb
graphql-1.4.3 lib/graphql/id_type.rb
graphql-1.4.2 lib/graphql/id_type.rb
graphql-1.4.1 lib/graphql/id_type.rb
graphql-1.4.0 lib/graphql/id_type.rb