platform/packages/json_god/lib/src/validation.dart

26 lines
543 B
Dart
Raw Normal View History

2021-05-14 12:24:45 +00:00
part of angel3_json_god;
2021-03-07 15:56:09 +00:00
/// Thrown when schema validation fails.
class JsonValidationError implements Exception {
//final Schema schema;
final invalidData;
final String cause;
const JsonValidationError(
2021-05-15 07:28:00 +00:00
this.cause, this.invalidData); //, Schema this.schema);
2021-03-07 15:56:09 +00:00
}
/// Specifies a schema to validate a class with.
class WithSchema {
final Map schema;
2021-05-15 07:28:00 +00:00
const WithSchema(this.schema);
2021-03-07 15:56:09 +00:00
}
/// Specifies a schema to validate a class with.
class WithSchemaUrl {
final String schemaUrl;
2021-05-15 07:28:00 +00:00
const WithSchemaUrl(this.schemaUrl);
2021-03-07 15:56:09 +00:00
}