@PublicApi
public class ValidationRules
extends java.lang.Object
ValidationRules is a holder of validation rules
and you can then pass it field and arguments and narrow down the list of actual rules
that apply to those fields and arguments.
It also allows you to run the appropriate rules via the
runValidationRules(graphql.schema.DataFetchingEnvironment) method.
| Modifier and Type | Class and Description |
|---|---|
static class |
ValidationRules.Builder |
| Modifier and Type | Method and Description |
|---|---|
TargetedValidationRules |
buildRulesFor(graphql.schema.GraphQLFieldDefinition fieldDefinition,
graphql.schema.GraphQLFieldsContainer fieldsContainer) |
java.util.Locale |
getLocale() |
MessageInterpolator |
getMessageInterpolator() |
OnValidationErrorStrategy |
getOnValidationErrorStrategy() |
java.util.List<ValidationRule> |
getRules() |
java.util.List<ValidationRule> |
getRulesFor(graphql.schema.GraphQLArgument fieldArg,
graphql.schema.GraphQLFieldDefinition fieldDefinition,
graphql.schema.GraphQLFieldsContainer fieldsContainer) |
java.util.List<ValidationRule> |
getRulesFor(graphql.schema.GraphQLFieldDefinition fieldDefinition,
graphql.schema.GraphQLFieldsContainer fieldsContainer) |
static ValidationRules.Builder |
newValidationRules()
A builder of validation rules.
|
java.util.List<graphql.GraphQLError> |
runValidationRules(graphql.schema.DataFetchingEnvironment env)
This helper method will run the validation rules that apply to the provided
DataFetchingEnvironment |
public MessageInterpolator getMessageInterpolator()
public java.util.Locale getLocale()
public java.util.List<ValidationRule> getRules()
public OnValidationErrorStrategy getOnValidationErrorStrategy()
public TargetedValidationRules buildRulesFor(graphql.schema.GraphQLFieldDefinition fieldDefinition, graphql.schema.GraphQLFieldsContainer fieldsContainer)
public java.util.List<ValidationRule> getRulesFor(graphql.schema.GraphQLArgument fieldArg, graphql.schema.GraphQLFieldDefinition fieldDefinition, graphql.schema.GraphQLFieldsContainer fieldsContainer)
public java.util.List<ValidationRule> getRulesFor(graphql.schema.GraphQLFieldDefinition fieldDefinition, graphql.schema.GraphQLFieldsContainer fieldsContainer)
public java.util.List<graphql.GraphQLError> runValidationRules(graphql.schema.DataFetchingEnvironment env)
DataFetchingEnvironmentenv - the data fetching environmentpublic static ValidationRules.Builder newValidationRules()
DirectiveConstraints.STANDARD_CONSTRAINTS are included
but you can add extra rules or call ValidationRules.Builder.clearRules()
to start afresh.