JsonSchemaRegistry class final
The JSON Schema documents a $ref to another document is resolved
in, by their absolute URI.
final registry = JsonSchemaRegistry()
..add(JsonSchema.parse(addressJson)); // its $id: https://x.org/address.json
final order = JsonSchema.parse(
'{"\$id": "https://x.org/order.json",'
' "properties": {"to": {"\$ref": "address.json"}}}',
registry: registry,
);
Spring (Java): Spring has no counterpart.
Constructors
-
JsonSchemaRegistry([Iterable<
JsonSchema> schemas = const []]) -
A registry holding
schemas(each by its JsonSchema.id).
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
schemas
→ Map<
Uri, JsonSchema> -
The schemas added, by the URI each is known by (read only).
no setter
Methods
-
add(
JsonSchema schema, {Uri? uri}) → void -
Adds
schemabyuri, else by its JsonSchema.id; throws an ArgumentError when it has neither. A later schema for the same URI replaces the earlier one. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolve(
Uri uri) → JsonSchema? -
The schema known by
uri(its fragment is ignored): one added by that URI, else a subschema with that$idin one of them;nullwhen there is none. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited