json_schema_utils 1.0.0-dev.7
json_schema_utils: ^1.0.0-dev.7 copied to clipboard
Utilities for building Json Schema Documents to ensure they are valid and assist with reducing the complexity of creating a schema manually
json_schema_utils #
JSONSchema Utils provides tools to help programmatically build JSONSchema Documents
Compatible with all Dart environments, including Flutter (Web, Mobile and Desktop), Dart Cli, WASM, Server etc.
Features #
- JSONSchema Support
- Opinionated JSONSchema Document
- Required $schema (Currently only supports JSON Schema Draft 7)
- Required $id
- Required title
- Required description
- Validation of spec / schema compliance while building examples
Planned Features #
- Validation of schema restrictions to avoid conflict or impossible schemas
- Support for Additional JSON Schema versions
- Support for utilizing Schema Registries for loading, storage and versioning of schemas (possibly with a separate package TBD)
Getting started #
Usage #
class Example {
Example() {
try {
var schema = JsonSchemaDocument(
"https://indiealexh.dev/schema/vehicle",
"Vehicle Schema",
"A Schema to describe a vehicle",
);
schema
..comment = "This is a comment"
..defaultValue = {"type": "sedan"}
..examples = [
{"type": "sedan"},
{"type": "suv"},
]
..readOnly = true
..writeOnly = false;
} catch (e) {
print('Error: $e');
}
}
}