Sha256: b1e84ca797825ac3ab89a2ae0bb027eca3b0b968c5832fed556220ae26734d74
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
module GraphQL module Define # Turn field configs into a {GraphQL::Field} and attach it to a {GraphQL::ObjectType} or {GraphQL::InterfaceType} module AssignObjectField def self.call(fields_type, name, type_or_field = nil, desc = nil, field: nil, deprecation_reason: nil, property: nil, complexity: nil, hash_key: nil, &block) if type_or_field.is_a?(GraphQL::Field) field = type_or_field elsif block_given? field = GraphQL::Field.define(&block) elsif field.nil? field = GraphQL::Field.new end if !type_or_field.nil? && !type_or_field.is_a?(GraphQL::Field) field.type = type_or_field end desc && field.description = desc # If the field's resolve proc was defined in the config block, # don't override it with `property` or `hash_key` if field.resolve_proc.is_a?(GraphQL::Field::Resolve::BuiltInResolve) property && field.property = property hash_key && field.hash_key = hash_key end complexity && field.complexity = complexity deprecation_reason && field.deprecation_reason = deprecation_reason field.name ||= name.to_s fields_type.fields[name.to_s] = field end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
graphql-0.17.2 | lib/graphql/define/assign_object_field.rb |
graphql-0.17.1 | lib/graphql/define/assign_object_field.rb |
graphql-0.17.0 | lib/graphql/define/assign_object_field.rb |