Class ValidationRules


  • @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.

    • Method Detail

      • getLocale

        public java.util.Locale getLocale()
      • buildRulesFor

        public TargetedValidationRules buildRulesFor​(graphql.schema.GraphQLFieldDefinition fieldDefinition,
                                                     graphql.schema.GraphQLFieldsContainer fieldsContainer)
      • getRulesFor

        public java.util.List<ValidationRule> getRulesFor​(graphql.schema.GraphQLArgument fieldArg,
                                                          graphql.schema.GraphQLFieldDefinition fieldDefinition,
                                                          graphql.schema.GraphQLFieldsContainer fieldsContainer)
      • getRulesFor

        public java.util.List<ValidationRule> getRulesFor​(graphql.schema.GraphQLFieldDefinition fieldDefinition,
                                                          graphql.schema.GraphQLFieldsContainer fieldsContainer)
      • runValidationRules

        public java.util.List<graphql.GraphQLError> runValidationRules​(graphql.schema.DataFetchingEnvironment env)
        This helper method will run the validation rules that apply to the provided DataFetchingEnvironment
        Parameters:
        env - the data fetching environment
        Returns:
        a list of zero or more input data validation errors