Validate BAST documents against the meta-schema at compile time
Resolves review #003 finding M3. - Add bast_meta::validate_bast_doc and call it from AlkTypeEngine::compile before parsing. Malformed annotations (unknown endian/encoding strings, non-integer align/maxLength, missing required properties) now surface as AlkTypeError::Schema instead of being silently tolerated by the parser. - Align the meta-schema TypeRef with the parser: allow inline struct/union/ enum as TypeRefs (the parser and builder already accepted them; the meta-schema and spec did not). Update bast-format.md TypeRef table and the BastType doc comment to the seven-form vocabulary. Verification: cargo test --release (410 pass), cargo clippy --all-targets -- -D warnings (clean), cargo doc --no-deps (clean), cargo build --target wasm32-unknown-unknown --release (clean).
This commit is contained in:
1 parent
e5c7cc1ca2
commit
230345a867
4 files changed
+155
-6
No files matched your search
+5
-5
@@ -681,12 +681,12 @@ impl<'a> BastEnum<'a> {
|
||||
/// A type reference — the central mechanism for typing fields, array
|
||||
/// elements, record values, and union variants.
|
||||
///
|
||||
/// Four forms, matching the
|
||||
/// Seven forms, matching the
|
||||
/// [TypeRef](../docs/architecture/bast-format.md#typeref) `oneOf`:
|
||||
/// primitive string, `$ref` object, array object, record object.
|
||||
/// Composite kinds (`struct`/`union`/`enum`) only appear inline here when
|
||||
/// a field/element/value is an anonymous composite; named composites go
|
||||
/// through [`BastType::Ref`].
|
||||
/// primitive string, `$ref` object, array object, record object, and
|
||||
/// inline `struct`/`union`/`enum`. Composite kinds (`struct`/`union`/
|
||||
/// `enum`) appear inline here when a field/element/value is an anonymous
|
||||
/// composite; named composites go through [`BastType::Ref`].
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum BastType<'a> {
|
||||
/// A built-in primitive (`"uint32"`, `"string"`, etc.).
|
||||
|
||||
Reference in new issue
Block a user