Interface ValidationRule

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean appliesTo​(graphql.schema.GraphQLArgument argument, graphql.schema.GraphQLFieldDefinition fieldDefinition, graphql.schema.GraphQLFieldsContainer fieldsContainer)
      This is called to work out if this rule applies to the argument of a specified field
      boolean appliesTo​(graphql.schema.GraphQLFieldDefinition fieldDefinition, graphql.schema.GraphQLFieldsContainer fieldsContainer)
      This is called to work out if this rule applies to a specified field
      java.util.List<graphql.GraphQLError> runValidation​(ValidationEnvironment validationEnvironment)
      This is called to runs the rule.
    • Method Detail

      • appliesTo

        boolean appliesTo​(graphql.schema.GraphQLFieldDefinition fieldDefinition,
                          graphql.schema.GraphQLFieldsContainer fieldsContainer)
        This is called to work out if this rule applies to a specified field
        Parameters:
        fieldDefinition - the field to check
        fieldsContainer - the field container
        Returns:
        true if this rule applies to the field
      • appliesTo

        boolean appliesTo​(graphql.schema.GraphQLArgument argument,
                          graphql.schema.GraphQLFieldDefinition fieldDefinition,
                          graphql.schema.GraphQLFieldsContainer fieldsContainer)
        This is called to work out if this rule applies to the argument of a specified field
        Parameters:
        argument - the argument to check
        fieldDefinition - the field to check
        fieldsContainer - the field container
        Returns:
        true if this rule applies to the argument of the field field
      • runValidation

        java.util.List<graphql.GraphQLError> runValidation​(ValidationEnvironment validationEnvironment)
        This is called to runs the rule. A rule maybe invoked MULTIPLE times per field. It will be invoked once for the original field, then invoked for each of the arguments on a field and then if the input types are complex ones such as GraphQLInputObjectType then it will be invoked for each attribute of that type.

        A rule should consult ValidationEnvironment.getValidatedElement() to check what element is being validated. If the rule does not handle that type of element, simply return an empty list of errors.

        Parameters:
        validationEnvironment - the validation environment
        Returns:
        a non null list of errors where emptyList() means its valid