Sha256: 41f0806e2034057451cb21fb6824c001ca80937caf4f10b35b57bb0336181d9b

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Rails
  module GraphQL
    class Type
      # The introspection object for directives
      class Object::DirectiveObject < Object
        self.assigned_to = 'Rails::GraphQL::Directive'
        self.spec_object = true

        rename! '__Directive'

        desc <<~DESC
          Directives provide a way to describe alternate runtime execution
          and type validation behavior in a GraphQL document.

          In some cases, you need to provide options to alter GraphQL's execution
          behavior in ways field arguments will not suffice, such as conditionally
          including or skipping a field. Directives provide this by describing
          additional information to the executor.
        DESC

        field :name,          :string,               null: false, method_name: :gql_name
        field :description,   :string
        field :locations,     '__DirectiveLocation', full: true
        field :args,          '__InputValue',        full: true
        field :is_repeatable, :boolean,              null: false, method_name: :repeatable?

        def args
          all_arguments.each_value
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-graphql-1.0.2 lib/rails/graphql/type/object/directive_object.rb
rails-graphql-1.0.1 lib/rails/graphql/type/object/directive_object.rb
rails-graphql-1.0.0 lib/rails/graphql/type/object/directive_object.rb
rails-graphql-1.0.0.rc2 lib/rails/graphql/type/object/directive_object.rb
rails-graphql-1.0.0.rc1 lib/rails/graphql/type/object/directive_object.rb