SchemaParser class final
Parses a JSON Schema subset map into a SchemaRule tree.
Example:
final rule = SchemaParser().parse({
'required': ['name', 'email'],
'properties': {
'name': {'type': 'string', 'minLength': 1},
'email': {'type': 'string', 'format': 'email'},
'age': {'type': 'integer', 'minimum': 0},
},
});
final violations = rule.validate({'name': 'Alice'}, '');
// → [{path: 'email', message: 'required field is missing'}]
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
Map< String, dynamic> schema) → SchemaRule -
Parses
schemainto a SchemaRule tree. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited