Class: GraphQL::Introspection::TypeType
- Inherits:
-
BaseObject
- Object
- Schema::Member
- Schema::Object
- BaseObject
- GraphQL::Introspection::TypeType
- Defined in:
- lib/graphql/introspection/type_type.rb
Constant Summary
Constants included from Schema::Member::HasFields
Schema::Member::HasFields::CONFLICT_FIELD_NAMES, Schema::Member::HasFields::GRAPHQL_RUBY_KEYWORDS, Schema::Member::HasFields::RUBY_KEYWORDS
Constants included from Schema::Member::HasDirectives
Schema::Member::HasDirectives::NO_DIRECTIVES
Constants included from Schema::Member::GraphQLTypeNames
Schema::Member::GraphQLTypeNames::Boolean, Schema::Member::GraphQLTypeNames::ID, Schema::Member::GraphQLTypeNames::Int
Instance Attribute Summary
Attributes inherited from Schema::Object
Attributes included from Schema::Member::BaseDSLMethods
Instance Method Summary collapse
-
#enum_values(include_deprecated:) ⇒ Object
-
#fields(include_deprecated:) ⇒ Object
-
#input_fields(include_deprecated:) ⇒ Object
-
#interfaces ⇒ Object
-
#is_one_of ⇒ Object
-
#kind ⇒ Object
-
#of_type ⇒ Object
-
#possible_types ⇒ Object
-
#specified_by_url ⇒ Object
Methods inherited from BaseObject
Methods inherited from Schema::Object
authorized_new, const_missing, #dataloader, #initialize, kind, #raw_value
Methods included from Schema::Member::HasFields
#add_field, #all_field_definitions, #field, #field_class, #get_field, #global_id_field, #own_fields
Methods included from Schema::Member::HasInterfaces
#implements, #interface_type_memberships, #own_interface_type_memberships
Methods included from Schema::Member::BaseDSLMethods
#authorized?, #description, #graphql_name, #introspection, #introspection?, #mutation, #name, #visible?
Methods included from Schema::Member::BaseDSLMethods::ConfigurationExtension
Methods included from Schema::Member::TypeSystemHelpers
#initialize, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature
Methods included from Schema::Member::Scoped
Methods included from Schema::Member::RelayShortcuts
#connection_type, #connection_type_class, #edge_type, #edge_type_class
Methods included from Schema::Member::HasPath
Methods included from Schema::Member::HasAstNode
Methods included from Schema::Member::HasDirectives
add_directive, #directive, #directives, get_directives, #remove_directive, remove_directive
Constructor Details
This class inherits a constructor from GraphQL::Schema::Object
Instance Method Details
#enum_values(include_deprecated:) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/graphql/introspection/type_type.rb', line 51 def enum_values(include_deprecated:) if !@object.kind.enum? nil else enum_values = @context.warden.enum_values(@object) if !include_deprecated enum_values = enum_values.select {|f| !f.deprecation_reason } end enum_values end end |
#fields(include_deprecated:) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/graphql/introspection/type_type.rb', line 91 def fields(include_deprecated:) if !@object.kind.fields? nil else fields = @context.warden.fields(@object) if !include_deprecated fields = fields.select {|f| !f.deprecation_reason } end fields.sort_by(&:name) end end |
#input_fields(include_deprecated:) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/graphql/introspection/type_type.rb', line 73 def input_fields(include_deprecated:) if @object.kind.input_object? args = @context.warden.arguments(@object) args = args.reject(&:deprecation_reason) unless include_deprecated args else nil end end |
#interfaces ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/graphql/introspection/type_type.rb', line 65 def interfaces if @object.kind.object? || @object.kind.interface? @context.warden.interfaces(@object).sort_by(&:graphql_name) else nil end end |
#is_one_of ⇒ Object
34 35 36 37 |
# File 'lib/graphql/introspection/type_type.rb', line 34 def is_one_of object.kind.input_object? && object.directives.any? { |d| d.graphql_name == "oneOf" } end |
#kind ⇒ Object
47 48 49 |
# File 'lib/graphql/introspection/type_type.rb', line 47 def kind @object.kind.name end |
#of_type ⇒ Object
103 104 105 |
# File 'lib/graphql/introspection/type_type.rb', line 103 def of_type @object.kind.wraps? ? @object.of_type : nil end |
#possible_types ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/graphql/introspection/type_type.rb', line 83 def possible_types if @object.kind.abstract? @context.warden.possible_types(@object).sort_by(&:graphql_name) else nil end end |
#specified_by_url ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/graphql/introspection/type_type.rb', line 39 def specified_by_url if object.kind.scalar? object.specified_by_url else nil end end |