Sha256: b6e530bec4ed335f6ebe73190f5913e4b5472a2c382aa886c2ad33b000ab9d6a

Contents?: true

Size: 1.17 KB

Versions: 37

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true
module GraphQL
  module Introspection
    class InputValueType < Introspection::BaseObject
      graphql_name "__InputValue"
      description "Arguments provided to Fields or Directives and the input fields of an "\
                  "InputObject are represented as Input Values which describe their type and "\
                  "optionally a default value."
      field :name, String, null: false
      field :description, String, null: true
      field :type, GraphQL::Schema::LateBoundType.new("__Type"), null: false
      field :default_value, String, "A GraphQL-formatted string representing the default value for this input value.", null: true

      def default_value
        if @object.default_value?
          value = @object.default_value
          if value.nil?
            'null'
          else
            coerced_default_value = @object.type.coerce_result(value, @context)
            if @object.type.unwrap.is_a?(GraphQL::EnumType)
              coerced_default_value
            else
              GraphQL::Language.serialize(coerced_default_value)
            end
          end
        else
          nil
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
graphql-1.8.18 lib/graphql/introspection/input_value_type.rb
graphql-1.9.4 lib/graphql/introspection/input_value_type.rb
graphql-1.9.3 lib/graphql/introspection/input_value_type.rb
graphql-1.9.2 lib/graphql/introspection/input_value_type.rb
graphql-1.8.17 lib/graphql/introspection/input_value_type.rb
graphql-1.8.16 lib/graphql/introspection/input_value_type.rb
graphql-1.9.1 lib/graphql/introspection/input_value_type.rb
graphql-1.9.0 lib/graphql/introspection/input_value_type.rb
graphql-1.8.15 lib/graphql/introspection/input_value_type.rb
graphql-1.9.0.pre4 lib/graphql/introspection/input_value_type.rb
graphql-1.8.14 lib/graphql/introspection/input_value_type.rb
graphql-1.9.0.pre3 lib/graphql/introspection/input_value_type.rb
graphql-1.9.0.pre2 lib/graphql/introspection/input_value_type.rb
graphql-1.8.13 lib/graphql/introspection/input_value_type.rb
graphql-1.8.12 lib/graphql/introspection/input_value_type.rb
graphql-1.9.0.pre1 lib/graphql/introspection/input_value_type.rb
graphql-1.8.11 lib/graphql/introspection/input_value_type.rb
graphql-1.8.10 lib/graphql/introspection/input_value_type.rb
graphql-1.8.9 lib/graphql/introspection/input_value_type.rb
graphql-1.8.8 lib/graphql/introspection/input_value_type.rb