Class: GraphQL::Introspection::TypeType
Constant Summary
Schema::Member::HasFields::CONFLICT_FIELD_NAMES, Schema::Member::HasFields::GRAPHQL_RUBY_KEYWORDS, Schema::Member::HasFields::RUBY_KEYWORDS
EmptyObjects::EMPTY_ARRAY, EmptyObjects::EMPTY_HASH
Schema::Member::GraphQLTypeNames::Boolean, Schema::Member::GraphQLTypeNames::ID, Schema::Member::GraphQLTypeNames::Int
Instance Attribute Summary
#context, #object
#default_graphql_name, #graphql_name
#connection_type, #connection_type_class, #edge_type, #edge_type_class
#ast_node
Class Method Summary
collapse
-
.resolve_enum_values(object, context, include_deprecated:) ⇒ Object
-
.resolve_fields(object, context, include_deprecated:) ⇒ Object
-
.resolve_input_fields(object, context, include_deprecated:) ⇒ Object
-
.resolve_interfaces(object, context) ⇒ Object
-
.resolve_is_one_of(object, _ctx) ⇒ Object
-
.resolve_kind(object, context) ⇒ Object
-
.resolve_of_type(object, _ctx) ⇒ Object
-
.resolve_possible_types(object, context) ⇒ Object
-
.resolve_specified_by_url(object, _ctx) ⇒ Object
Instance Method Summary
collapse
Methods inherited from BaseObject
field
authorized_new, const_missing, #dataloader, #initialize, kind, #raw_value, scoped_new, wrap, wrap_scoped
#add_field, #all_field_definitions, #field, #field_class, #global_id_field, #has_no_fields, #has_no_fields?, #own_fields
#implements, #interface_type_memberships, #own_interface_type_memberships
#dataload, #dataload_all, #dataload_association, #dataload_record, #dataloader
#authorized?, #comment, #default_relay, #description, #introspection, #introspection?, #mutation, #name, #visible?
#inherited
#initialize, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature
#inherited, #reauthorize_scoped_objects, #scope_items
#path
#inherited
add_directive, #directive, #directives, get_directives, #inherited, #remove_directive, remove_directive
Class Method Details
.resolve_enum_values(object, context, include_deprecated:) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/graphql/introspection/type_type.rb', line 63
def self.resolve_enum_values(object, context, include_deprecated:)
if !object.kind.enum?
nil
else
enum_values = context.types.enum_values(object)
if !include_deprecated
enum_values = enum_values.select {|f| !f.deprecation_reason }
end
enum_values
end
end
|
.resolve_fields(object, context, include_deprecated:) ⇒ Object
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/graphql/introspection/type_type.rb', line 119
def self.resolve_fields(object, context, include_deprecated:)
if !object.kind.fields?
nil
else
fields = context.types.fields(object)
if !include_deprecated
fields = fields.select {|f| !f.deprecation_reason }
end
fields.sort_by(&:name)
end
end
|
93
94
95
96
97
98
99
100
101
|
# File 'lib/graphql/introspection/type_type.rb', line 93
def self.resolve_input_fields(object, context, include_deprecated:)
if object.kind.input_object?
args = context.types.arguments(object)
args = args.reject(&:deprecation_reason) unless include_deprecated
args
else
nil
end
end
|
.resolve_interfaces(object, context) ⇒ Object
81
82
83
84
85
86
87
|
# File 'lib/graphql/introspection/type_type.rb', line 81
def self.resolve_interfaces(object, context)
if object.kind.object? || object.kind.interface?
context.types.interfaces(object).sort_by(&:graphql_name)
else
nil
end
end
|
.resolve_is_one_of(object, _ctx) ⇒ Object
34
35
36
37
|
# File 'lib/graphql/introspection/type_type.rb', line 34
def self.resolve_is_one_of(object, _ctx)
object.kind.input_object? &&
object.directives.any? { |d| d.graphql_name == "oneOf" }
end
|
.resolve_kind(object, context) ⇒ Object
55
56
57
|
# File 'lib/graphql/introspection/type_type.rb', line 55
def self.resolve_kind(object, context)
object.kind.name
end
|
.resolve_of_type(object, _ctx) ⇒ Object
135
136
137
|
# File 'lib/graphql/introspection/type_type.rb', line 135
def self.resolve_of_type(object, _ctx)
object.kind.wraps? ? object.of_type : nil
end
|
.resolve_possible_types(object, context) ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/graphql/introspection/type_type.rb', line 107
def self.resolve_possible_types(object, context)
if object.kind.abstract?
context.types.possible_types(object).sort_by(&:graphql_name)
else
nil
end
end
|
.resolve_specified_by_url(object, _ctx) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/graphql/introspection/type_type.rb', line 43
def self.resolve_specified_by_url(object, _ctx)
if object.kind.scalar?
object.specified_by_url
else
nil
end
end
|
Instance Method Details
#enum_values(include_deprecated:) ⇒ Object
77
78
79
|
# File 'lib/graphql/introspection/type_type.rb', line 77
def enum_values(include_deprecated:)
self.class.resolve_enum_values(object, context, include_deprecated: include_deprecated)
end
|
#fields(include_deprecated:) ⇒ Object
131
132
133
|
# File 'lib/graphql/introspection/type_type.rb', line 131
def fields(include_deprecated:)
self.class.resolve_fields(object, context, include_deprecated: include_deprecated)
end
|
103
104
105
|
# File 'lib/graphql/introspection/type_type.rb', line 103
def input_fields(include_deprecated:)
self.class.resolve_input_fields(object, context, include_deprecated: include_deprecated)
end
|
#interfaces ⇒ Object
89
90
91
|
# File 'lib/graphql/introspection/type_type.rb', line 89
def interfaces
self.class.resolve_interfaces(object, context)
end
|
#is_one_of ⇒ Object
39
40
41
|
# File 'lib/graphql/introspection/type_type.rb', line 39
def is_one_of
self.class.resolve_is_one_of(object, context)
end
|
#kind ⇒ Object
59
60
61
|
# File 'lib/graphql/introspection/type_type.rb', line 59
def kind
self.class.resolve_kind(object, context)
end
|
#of_type ⇒ Object
139
140
141
|
# File 'lib/graphql/introspection/type_type.rb', line 139
def of_type
self.class.resolve_of_type(object, context)
end
|
#possible_types ⇒ Object
115
116
117
|
# File 'lib/graphql/introspection/type_type.rb', line 115
def possible_types
self.class.resolve_possible_types(object, context)
end
|
#specified_by_url ⇒ Object
51
52
53
|
# File 'lib/graphql/introspection/type_type.rb', line 51
def specified_by_url
self.class.resolve_specified_by_url(object, context)
end
|