Interface FieldValidationEnvironment
-
@PublicApi public interface FieldValidationEnvironment
This contains all of the field and their arguments for a given query. The methodgetFieldsByPath()
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 whygetFieldsByPath()
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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ExecutionContext
getExecutionContext()
java.util.List<FieldAndArguments>
getFields()
java.util.Map<ResultPath,java.util.List<FieldAndArguments>>
getFieldsByPath()
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.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.
-
-
-
Method Detail
-
getExecutionContext
ExecutionContext getExecutionContext()
- Returns:
- the schema in play
-
getFields
java.util.List<FieldAndArguments> getFields()
- Returns:
- a list of
FieldAndArguments
-
getFieldsByPath
java.util.Map<ResultPath,java.util.List<FieldAndArguments>> getFieldsByPath()
- Returns:
- a map of field paths to
FieldAndArguments
-
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 ofGraphQLError
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 ofGraphQLError
is valid- Parameters:
msg
- the error messagefieldAndArguments
- the field in error- Returns:
- a graphql error
-
-