Class NonNullableFieldValidator

java.lang.Object
graphql.execution.NonNullableFieldValidator

public class NonNullableFieldValidator extends Object
This will check that a value is non-null when the type definition says it must be and, it will throw NonNullableFieldWasNullException if this is not the case. See: https://spec.graphql.org/October2021/#sec-Errors-and-Non-Nullability
  • Constructor Details

    • NonNullableFieldValidator

      public NonNullableFieldValidator(ExecutionContext executionContext)
  • Method Details

    • validate

      public <T> T validate(ExecutionStrategyParameters parameters, T result) throws NonNullableFieldWasNullException
      Called to check that a value is non-null if the type requires it to be non null
      Type Parameters:
      T - the type of the result
      Parameters:
      parameters - the execution strategy parameters
      result - the result to check
      Returns:
      the result back
      Throws:
      NonNullableFieldWasNullException - if the value is null but the type requires it to be non null