From caa41e06db408e4acd0dd986ec376a847d676021 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 18 Nov 2024 11:26:00 -0500 Subject: [PATCH] Remove unused ErrorHelper --- lib/graphql/static_validation/error.rb | 10 ---------- .../rules/argument_names_are_unique.rb | 2 -- .../rules/fields_have_appropriate_selections.rb | 2 -- .../rules/no_definitions_are_present.rb | 2 -- 4 files changed, 16 deletions(-) diff --git a/lib/graphql/static_validation/error.rb b/lib/graphql/static_validation/error.rb index d8a4e94036..7c1cfec391 100644 --- a/lib/graphql/static_validation/error.rb +++ b/lib/graphql/static_validation/error.rb @@ -3,16 +3,6 @@ module GraphQL module StaticValidation # Generates GraphQL-compliant validation message. class Error - # Convenience for validators - module ErrorHelper - # Error `error_message` is located at `node` - def error(error_message, nodes, context: nil, path: nil, extensions: {}) - path ||= context.path - nodes = Array(nodes) - GraphQL::StaticValidation::Error.new(error_message, nodes: nodes, path: path) - end - end - attr_reader :message attr_accessor :path diff --git a/lib/graphql/static_validation/rules/argument_names_are_unique.rb b/lib/graphql/static_validation/rules/argument_names_are_unique.rb index bc8fcea305..728fc6c334 100644 --- a/lib/graphql/static_validation/rules/argument_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/argument_names_are_unique.rb @@ -2,8 +2,6 @@ module GraphQL module StaticValidation module ArgumentNamesAreUnique - include GraphQL::StaticValidation::Error::ErrorHelper - def on_field(node, parent) validate_arguments(node) super diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb index feaab2e733..a91d4f3e18 100644 --- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb @@ -4,8 +4,6 @@ module StaticValidation # Scalars _can't_ have selections # Objects _must_ have selections module FieldsHaveAppropriateSelections - include GraphQL::StaticValidation::Error::ErrorHelper - def on_field(node, parent) field_defn = field_definition if validate_field_selections(node, field_defn.type.unwrap) diff --git a/lib/graphql/static_validation/rules/no_definitions_are_present.rb b/lib/graphql/static_validation/rules/no_definitions_are_present.rb index 7debd19b55..e181a4b9c1 100644 --- a/lib/graphql/static_validation/rules/no_definitions_are_present.rb +++ b/lib/graphql/static_validation/rules/no_definitions_are_present.rb @@ -2,8 +2,6 @@ module GraphQL module StaticValidation module NoDefinitionsArePresent - include GraphQL::StaticValidation::Error::ErrorHelper - def initialize(*) super @schema_definition_nodes = []