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:
-
Method Summary
Modifier and TypeMethodDescriptionThis helper method allows you to make error messages to be passed back out in case of validation failure.mkError
(String msg, FieldAndArguments fieldAndArguments) This helper method allows you to make error messages to be passed back out in case of validation failure.
-
Method Details
-
getExecutionContext
ExecutionContext getExecutionContext()- Returns:
- the schema in play
-
getFields
List<FieldAndArguments> getFields()- Returns:
- a list of
FieldAndArguments
-
getFieldsByPath
Map<ResultPath,List<FieldAndArguments>> getFieldsByPath()- Returns:
- a map of field paths to
FieldAndArguments
-
mkError
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
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
-