Interface FieldValidationEnvironment


  • @PublicApi
    public interface FieldValidationEnvironment
    This contains all of the field and their arguments for a given query. The method getFieldsByPath() will be where most of the useful validation information is contained. It also gives you a helper to make validation error messages. One thing to note is that because queries can have repeating fragments, the same logical field can appear multiple times with different input values. That is why getFieldsByPath() returns a list of fields and their arguments. if you don't have fragments then the list will be of size 1
    See Also:
    FieldAndArguments
    • Method Detail

      • getExecutionContext

        ExecutionContext getExecutionContext()
        Returns:
        the schema in play
      • mkError

        GraphQLError mkError​(java.lang.String msg)
        This helper method allows you to make error messages to be passed back out in case of validation failure. Note you don't NOT have to use this helper. Any implementation of GraphQLError is valid
        Parameters:
        msg - the error message
        Returns:
        a graphql error
      • mkError

        GraphQLError mkError​(java.lang.String msg,
                             FieldAndArguments fieldAndArguments)
        This helper method allows you to make error messages to be passed back out in case of validation failure. Note you don't NOT have to use this helper. Any implementation of GraphQLError is valid
        Parameters:
        msg - the error message
        fieldAndArguments - the field in error
        Returns:
        a graphql error