Interface FieldValidation

  • All Known Implementing Classes:
    SimpleFieldValidation

    @PublicSpi
    public interface FieldValidation
    This pluggable interface allows you to validate the fields and their argument inputs before query execution. You will be called with fields and their arguments expanded out ready for execution and you can check business logic concerns like the lengths of input objects (eg an input string cant be longer than say 255 chars) or that the input objects have a certain shape that is required for this query. You are only called once with all the field information expanded out for you. This allows you to set up cross field business rules, for example if field argument X has a value then field Y argument must also have a value say.
    See Also:
    FieldValidationEnvironment, SimpleFieldValidation
    • Method Detail

      • validateFields

        java.util.List<GraphQLError> validateFields​(FieldValidationEnvironment validationEnvironment)
        This is called to validate the fields and their arguments
        Parameters:
        validationEnvironment - the validation environment
        Returns:
        a list of errors. If this is non empty then the query will not execute.