Sha256: e84f3e93e366e738a8f7963eff4968a3adf89532a365678638362c9fcf392855

Contents?: true

Size: 541 Bytes

Versions: 7

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true
GraphQL::Introspection::EnumValuesField = GraphQL::Field.define do
  type types[!GraphQL::Introspection::EnumValueType]
  introspection true
  argument :includeDeprecated, types.Boolean, default_value: false
  resolve ->(object, arguments, context) do
    if !object.kind.enum?
      nil
    else
      enum_values = context.warden.enum_values(object)

      if !arguments["includeDeprecated"]
        enum_values = enum_values.select {|f| !f.deprecation_reason }
      end

      enum_values
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-1.7.14 lib/graphql/introspection/enum_values_field.rb
graphql-1.7.13 lib/graphql/introspection/enum_values_field.rb
graphql-1.7.12 lib/graphql/introspection/enum_values_field.rb
graphql-1.7.11 lib/graphql/introspection/enum_values_field.rb
graphql-1.7.10 lib/graphql/introspection/enum_values_field.rb
graphql-1.7.9 lib/graphql/introspection/enum_values_field.rb
graphql-1.7.8 lib/graphql/introspection/enum_values_field.rb