Sha256: 7944eb28cbbe7d7bd0035ac65aafb7daf3f178a83176f4a6476f240eec3f2ad1

Contents?: true

Size: 473 Bytes

Versions: 22

Compression:

Stored size: 473 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module StaticValidation
    module MutationRootExists
      def on_operation_definition(node, _parent)
        if node.operation_type == 'mutation' && context.query.types.mutation_root.nil?
          add_error(GraphQL::StaticValidation::MutationRootExistsError.new(
            'Schema is not configured for mutations',
            nodes: node
          ))
        else
          super
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
graphql-2.4.8 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.7 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.6 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.5 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.4 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.3 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.2 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.1 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.4.0 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.20 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.19 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.18 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.17 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.16 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.15 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.14 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.13 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.12 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.11 lib/graphql/static_validation/rules/mutation_root_exists.rb
graphql-2.3.10 lib/graphql/static_validation/rules/mutation_root_exists.rb