Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not force QueryValidator to use List #751

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait QueryValidator {
}

object QueryValidator {
val allRules: List[ValidationRule] = List(
val allRules: Seq[ValidationRule] = Seq(
new ValuesOfCorrectType,
new ExecutableDefinitions,
new FieldsOnCorrectType,
Expand Down Expand Up @@ -46,7 +46,7 @@ object QueryValidator {
new SingleFieldSubscriptions
)

def ruleBased(rules: List[ValidationRule]) = new RuleBasedQueryValidator(rules)
def ruleBased(rules: Seq[ValidationRule]) = new RuleBasedQueryValidator(rules)

val empty = new QueryValidator {
def validateQuery(schema: Schema[_, _], queryAst: ast.Document): Vector[Violation] =
Expand All @@ -56,7 +56,7 @@ object QueryValidator {
val default: RuleBasedQueryValidator = ruleBased(allRules)
}

class RuleBasedQueryValidator(rules: List[ValidationRule]) extends QueryValidator {
class RuleBasedQueryValidator(rules: Seq[ValidationRule]) extends QueryValidator {
def validateQuery(schema: Schema[_, _], queryAst: ast.Document): Vector[Violation] = {
val ctx = new ValidationContext(schema, queryAst, queryAst.sourceMapper, new TypeInfo(schema))

Expand Down Expand Up @@ -93,7 +93,7 @@ class RuleBasedQueryValidator(rules: List[ValidationRule]) extends QueryValidato
def validateUsingRules(
queryAst: ast.AstNode,
ctx: ValidationContext,
visitors: List[ValidationRule#AstValidatingVisitor],
visitors: Iterable[ValidationRule#AstValidatingVisitor],
topLevel: Boolean): Unit = AstVisitor.visitAstRecursive(
doc = queryAst,
onEnter = node => {
Expand Down