Package graphql.validation
Class Validator
- java.lang.Object
-
- graphql.validation.Validator
-
public class Validator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Validator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<AbstractRule>
createRules(ValidationContext validationContext, ValidationErrorCollector validationErrorCollector)
static int
getMaxValidationErrors()
static void
setMaxValidationErrors(int maxValidationErrors)
`graphql-java` will stop validation after a maximum number of validation messages has been reached.java.util.List<ValidationError>
validateDocument(GraphQLSchema schema, Document document, java.util.function.Predicate<java.lang.Class<?>> applyRule, java.util.Locale locale)
java.util.List<ValidationError>
validateDocument(GraphQLSchema schema, Document document, java.util.Locale locale)
-
-
-
Method Detail
-
setMaxValidationErrors
public static void setMaxValidationErrors(int maxValidationErrors)
`graphql-java` will stop validation after a maximum number of validation messages has been reached. Attackers can send pathologically invalid queries to induce a Denial of Service attack and fill memory with 10000s of errors and burn CPU in process. By default, this is set to 100 errors. You can set a new JVM wide value as the maximum allowed validation errors.- Parameters:
maxValidationErrors
- the maximum validation errors allow JVM wide
-
getMaxValidationErrors
public static int getMaxValidationErrors()
-
validateDocument
public java.util.List<ValidationError> validateDocument(GraphQLSchema schema, Document document, java.util.Locale locale)
-
validateDocument
public java.util.List<ValidationError> validateDocument(GraphQLSchema schema, Document document, java.util.function.Predicate<java.lang.Class<?>> applyRule, java.util.Locale locale)
-
createRules
public java.util.List<AbstractRule> createRules(ValidationContext validationContext, ValidationErrorCollector validationErrorCollector)
-
-