Module: Rails::GraphQL::Introspection
- Included in:
- Schema
- Defined in:
- lib/rails/graphql/introspection.rb
Overview
Module related to some methods regarding the introspection of a schema
Instance Method Summary collapse
-
#introspection? ⇒ Boolean
Check if the schema has introspection enabled.
-
#register! ⇒ Object
When register is called, add introspection related elements.
Instance Method Details
#introspection? ⇒ Boolean
Check if the schema has introspection enabled
23 24 25 |
# File 'lib/rails/graphql/introspection.rb', line 23 def introspection? false end |
#register! ⇒ Object
When register is called, add introspection related elements
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails/graphql/introspection.rb', line 8 def register!(*) super if defined? super enable_introspection! if !introspection? && config.enable_introspection # Although this is not necessary besides for introspection, there is no # real disadvantage on adding it Helpers::WithSchemaFields::TYPE_FIELD_CLASS.each_key do |type| GraphQL.type_map.register_alias(type_name_for(type), namespace: namespace) do result = public_send(:"#{type}_type") type.eql?(:query) || result.present? ? result : nil end end end |