class GraphQL::StaticValidation::DirectivesAreInValidLocations

def assert_includes_location(directive_defn, directive_ast, required_location, context)

def assert_includes_location(directive_defn, directive_ast, required_location, context)
  if !directive_defn.locations.include?(required_location)
    location_name = LOCATION_MESSAGE_NAMES[required_location]
    allowed_location_names = directive_defn.locations.map { |loc| LOCATION_MESSAGE_NAMES[loc] }
    context.errors << message("'@#{directive_defn.name}' can't be applied to #{location_name} (allowed: #{allowed_location_names.join(", ")})", directive_ast, context: context)
  end
end