class GraphQL::Directive


- ‘@include(if: …)` Includes the tagged field only if `if` is true
- `@skip(if: …)` Skips the tagged field if the value of `if` is true
Two directives are included out-of-the-box:
Directives are server-defined hooks for modifying execution.

def default_arguments

Returns:
  • (GraphQL::Query::Arguments) - Arguments to use when no args are provided in the query
def default_arguments
  @default_arguments ||= GraphQL::Query::LiteralInput.defaults_for(self.arguments)
end

def default_directive?

Returns:
  • (Boolean) - Is this directive supplied by default? (eg `@skip`)
def default_directive?
  @default_directive
end

def initialize

def initialize
  @arguments = {}
  @default_directive = false
end

def on_field?

def on_field?
  locations.include?(FIELD)
end

def on_fragment?

def on_fragment?
  locations.include?(FRAGMENT_SPREAD) && locations.include?(INLINE_FRAGMENT)
end

def on_operation?

def on_operation?
  locations.include?(QUERY) && locations.include?(MUTATION) && locations.include?(SUBSCRIPTION)
end

def to_s

def to_s
  "<GraphQL::Directive #{name}>"
end