json_schema_builder 0.1.2 copy "json_schema_builder: ^0.1.2" to clipboard
json_schema_builder: ^0.1.2 copied to clipboard

A full-featured package used to build and validate JSON schemas in Dart.

example/README.md

JSON Schema Builder Examples #

This directory contains examples demonstrating how to use the json_schema_builder package.

build_and_validate_schema.dart #

This is a comprehensive example that shows how to:

  1. Build a complex schema programmatically using the library's fluent API. The schema describes a "System Event" and uses advanced features like:
    • Nested ObjectSchemas.
    • ListSchema with unique item constraints.
    • StringSchema with regular expression patterns.
    • IntegerSchema with range constraints.
    • The oneOf combinator to enforce that the event data must match exactly one of several defined event types.
  2. Create valid and invalid data to test against the schema.
  3. Run the validator and print the detailed, human-readable error messages for the invalid data.

To run the example, execute the following command from the root of the json_schema_builder package:

dart run example/build_and_validate_schema.dart
2
likes
160
points
166
downloads

Publisher

verified publisherlabs.flutter.dev

Weekly Downloads

A full-featured package used to build and validate JSON schemas in Dart.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

args, characters, collection, decimal, http, intl, meta

More

Packages that depend on json_schema_builder