1.2 KiB
1.2 KiB
ADDED Requirements
Requirement: Schema package provides schema registry
The @suaveplan/bitpacker-schema package SHALL expose a SchemaRegistry that stores named schemas and resolves _ref tokens.
Scenario: Register and retrieve named schema
- WHEN
registry.register("player", { name: "-16", health: 255 })is called - THEN
registry.resolve("player")returns the registered schema
Requirement: Schema package provides validation
The @suaveplan/bitpacker-schema package SHALL validate that data conforms to a schema before packing.
Scenario: Validate data against schema
- WHEN
validate(data, schema)is called with data that exceeds a numeric range - THEN a
BitpackerErroris thrown with codeVALUE_OUT_OF_RANGE
Requirement: Schema package supports versioning
The @suaveplan/bitpacker-schema package SHALL support schema versioning with forward-compatibility rules.
Scenario: Versioned schema migration
- WHEN a schema contains
{ _version: 2, _schemas: [oldSchema, newSchema] } - THEN the correct schema is selected based on the version number
MODIFIED Requirements
None.
REMOVED Requirements
None.