Sha256: 3cafb636b2991166f0bd5eafc920cdec41b9ae4ff79d3f7806edcaf8df5098c4

Contents?: true

Size: 1.61 KB

Versions: 57

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true
module GraphQL
  module Introspection
    class DirectiveType < Introspection::BaseObject
      graphql_name "__Directive"
      description "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document."\
                  "\n\n"\
                  "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."
      field :name, String, null: false, method: :graphql_name
      field :description, String
      field :locations, [GraphQL::Schema::LateBoundType.new("__DirectiveLocation")], null: false, scope: false
      field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false, scope: false do
        argument :include_deprecated, Boolean, required: false, default_value: false
      end
      field :on_operation, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_operation?
      field :on_fragment, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_fragment?
      field :on_field, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_field?

      field :is_repeatable, Boolean, method: :repeatable?

      def args(include_deprecated:)
        args = @context.warden.arguments(@object)
        args = args.reject(&:deprecation_reason) unless include_deprecated
        args
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
graphql-2.2.16 lib/graphql/introspection/directive_type.rb
graphql-2.1.13 lib/graphql/introspection/directive_type.rb
graphql-2.3.7 lib/graphql/introspection/directive_type.rb
graphql-2.3.6 lib/graphql/introspection/directive_type.rb
graphql-2.3.5 lib/graphql/introspection/directive_type.rb
graphql-2.0.31 lib/graphql/introspection/directive_type.rb
graphql-2.3.2 lib/graphql/introspection/directive_type.rb
graphql-2.3.1 lib/graphql/introspection/directive_type.rb
graphql-1.13.23 lib/graphql/introspection/directive_type.rb
graphql-2.3.0 lib/graphql/introspection/directive_type.rb
graphql-2.2.14 lib/graphql/introspection/directive_type.rb
graphql-2.2.13 lib/graphql/introspection/directive_type.rb
graphql-2.2.12 lib/graphql/introspection/directive_type.rb
graphql-2.0.29 lib/graphql/introspection/directive_type.rb
graphql-2.1.12 lib/graphql/introspection/directive_type.rb
graphql-1.13.22 lib/graphql/introspection/directive_type.rb
graphql-2.2.11 lib/graphql/introspection/directive_type.rb
graphql-2.2.10 lib/graphql/introspection/directive_type.rb
graphql-2.2.9 lib/graphql/introspection/directive_type.rb
graphql-2.2.8 lib/graphql/introspection/directive_type.rb