-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Add Instance Validation Conformance Tests
Description
The validate/ folder currently has the step definitions and npm script (npm run test:instances) wired up, but validate/features/validate.feature is completely empty — there are zero instance validation test scenarios.
Instance validation (validating JSON data against Concerto models at runtime) is a core part of the Concerto runtime. Having conformance tests for this is critical, especially for validating cross-platform runtime implementations like the ongoing Rust port (concerto-rust, concerto-validate-rs).
Current State
- validate/validateSteps.js — Step definitions exist with 3 step types
npm run test:instances— Wired up in package.json- validate/features/validate.feature — Empty (0 scenarios)
validate/models/validate/— Only 2 sample files (1 valid, 1 invalid)
Proposed Changes
Add ~10 scenarios covering the following instance validation rules:
1. Primitive Type Validation
- Valid instance with all primitive types (
String,Integer,Double,Long,Boolean,DateTime) should pass - Type mismatch (e.g., string value for Integer field) should fail
- Type mismatch (e.g., string value for Boolean field) should fail
2. Required vs Optional Fields
- Missing a required field should fail validation
- Omitting an optional field should pass validation
- All required fields present should pass validation
3. Enum Instance Validation
- Valid enum value should pass
- Invalid enum value (not in enum definition) should fail
4. $class Type Resolution
$classmatching a defined type should pass$classreferencing a non-existent type should fail
Additional
This extends concerto-conformance to validate the Rust port. Without instance validation conformance tests, there is no way to verify that the Rust runtime correctly validates JSON data against Concerto models.