Sha256: 19a9491634a6c6733b2166195c2264717778fadbd4c1f45ddb799bb3483990c9

Contents?: true

Size: 685 Bytes

Versions: 50

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class Schema
    class Directive < GraphQL::Schema::Member
      class Include < GraphQL::Schema::Directive
        description "Directs the executor to include this field or fragment only when the `if` argument is true."

        locations(
          GraphQL::Schema::Directive::FIELD,
          GraphQL::Schema::Directive::FRAGMENT_SPREAD,
          GraphQL::Schema::Directive::INLINE_FRAGMENT
        )

        argument :if, Boolean, required: true,
          description: "Included when true."

        default_directive true

        def self.static_include?(args, ctx)
          !!args[:if]
        end
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
graphql-1.12.24 lib/graphql/schema/directive/include.rb
graphql-1.12.23 lib/graphql/schema/directive/include.rb
graphql-1.12.22 lib/graphql/schema/directive/include.rb
graphql-1.12.21 lib/graphql/schema/directive/include.rb
graphql-1.12.20 lib/graphql/schema/directive/include.rb
graphql-1.12.19 lib/graphql/schema/directive/include.rb
graphql-1.11.10 lib/graphql/schema/directive/include.rb
graphql-1.12.18 lib/graphql/schema/directive/include.rb
graphql-1.11.9 lib/graphql/schema/directive/include.rb
graphql-1.12.17 lib/graphql/schema/directive/include.rb
graphql-1.12.16 lib/graphql/schema/directive/include.rb
graphql-1.12.15 lib/graphql/schema/directive/include.rb
graphql-1.12.14 lib/graphql/schema/directive/include.rb
graphql-1.12.13 lib/graphql/schema/directive/include.rb
graphql-1.12.12 lib/graphql/schema/directive/include.rb
graphql-1.12.11 lib/graphql/schema/directive/include.rb
graphql-1.12.10 lib/graphql/schema/directive/include.rb
graphql-1.12.9 lib/graphql/schema/directive/include.rb
graphql-1.12.8 lib/graphql/schema/directive/include.rb
graphql-1.12.7 lib/graphql/schema/directive/include.rb