Sha256: b632b5c0baeb002cb0613111611970727dccb01ce93aa03dca66375a848c259e

Contents?: true

Size: 527 Bytes

Versions: 3

Compression:

Stored size: 527 Bytes

Contents

GraphQL::Introspection::EnumValuesField = GraphQL::Field.new do |f, type, field, arg|
  f.description "Values for this enum"
  f.type type[!GraphQL::Introspection::EnumValueType]
  f.arguments({
    includeDeprecated: arg.build({type: GraphQL::BOOLEAN_TYPE, default_value: false})
  })
  f.resolve -> (object, arguments, context) {
    return nil if !object.kind.enum?
    fields = object.values.values
    if !arguments["includeDeprecated"]
      fields = fields.select {|f| !f.deprecation_reason }
    end
    fields
  }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-0.4.0 lib/graph_ql/introspection/enum_values_field.rb
graphql-0.3.0 lib/graph_ql/introspection/enum_values_field.rb
graphql-0.2.0 lib/graph_ql/introspection/enum_values_field.rb