4e69153e3e
git-subtree-dir: packages/graphql git-subtree-mainline:ac29392d7f
git-subtree-split:33e2f86ba7
28 lines
757 B
Dart
28 lines
757 B
Dart
part of graphql_schema.src.schema;
|
|
|
|
/// Represents the result of asserting an input [value] against a [GraphQLType].
|
|
|
|
class ValidationResult<Value> {
|
|
/// `true` if there were no errors during validation.
|
|
final bool successful;
|
|
|
|
/// The input value passed to whatever caller invoked validation.
|
|
final Value value;
|
|
|
|
/// A list of errors that caused validation to fail.
|
|
final List<String> errors;
|
|
|
|
ValidationResult._(this.successful, this.value, this.errors);
|
|
|
|
ValidationResult._ok(this.value)
|
|
: errors = [],
|
|
successful = true;
|
|
|
|
ValidationResult._failure(this.errors)
|
|
: value = null,
|
|
successful = false;
|
|
|
|
// ValidationResult<T> _asFailure() {
|
|
// return new ValidationResult<T>._(false, value, errors);
|
|
// }
|
|
}
|