docs(typedef): sync specs with the implemented API surface
The code introduced concrete public types and a unified API during implementation that the specs described only conceptually. Sync the specs to match the code: - schema-layer.md: document the TypeDefKind enum and its inherent methods; add a Schema-Layer Public API section (get_typedef_kind vs get_typedef_kind_loose, annotation parsers, Endian/VariableEncoding/ DiscriminatorKind, normalize_refs/resolve_ref/resolve_ref_or_inline); fix the TRecord layout (values are encoded by their declared kind, not universally value_len-prefixed); fix the alignment default list. - layout-engine.md: document the LayoutMode enum and the ByteRange/ FieldPosition/PackedLayout/OffsetMap public types with their actual signatures; update the LayoutBuilder/SequentialReader/OffsetMap component descriptions with the real new/build/compute signatures. - data-access.md: document the FieldValue enum; add a Higher-level read/write section (TypedefEngine::read_field/write_field, SequentialReader::read_next/read_field); fix primitive signatures to include field_path and Endian; replace the wrong read_union_discriminator pseudo-code with the actual tunion module API (read_byte_discriminator/read_field_discriminator/resolve_variant/ discriminator_size) and the UnionDispatch struct. - validation.md: fix the TypedefEngine struct (add endian/schema fields, mark Layout as private); add the real compile signature (&mut Value, LayoutMode) and mode-appropriate accessors; fix engine.validate(buffer) -> engine.validate_json(&Value)/is_valid_json (the validator operates on serde_json::Value, not byte buffers — matches ADR-098). - overview.md: remove the stale ~1,900 lines / 26 tests line count. - ADR-097 §3a: correct the TRecord layout (no separate value_len prefix; the value is encoded by its declared TypeDef:* kind).
This commit is contained in:
1 parent
14d9cf281f
commit
7603f98799
7 files changed
+544
-279
No files matched your search
@@ -144,8 +144,15 @@ the `"values"` property in the schema:
|
||||
- `"values"` is a schema object declaring the `TypeDef:*` kind of all
|
||||
values in the record. All values share the same type.
|
||||
- The binary layout is a count-prefixed sequence of `(key, value)` pairs:
|
||||
`[count: u32][key_len: u32][key_bytes][value_len: u32][value_bytes]...`.
|
||||
- The count prefix respects the schema's endianness.
|
||||
`[count: u32][key_len: u32][key_bytes][value]...` repeated `count`
|
||||
times. Each key is a length-prefixed UTF-8 string. Each value is
|
||||
encoded according to its declared `TypeDef:*` kind — a `Record<Uint32>`
|
||||
value is 4 raw bytes; a `Record<String>` value is itself a
|
||||
length-prefixed string; a `Record<Struct>` value is the struct's
|
||||
fields laid out inline. There is **no separate `value_len` prefix** —
|
||||
the value's size is determined by its kind (fixed-size kinds have a
|
||||
known size; variable-length kinds carry their own length prefix).
|
||||
- The count and key-length prefixes respect the schema's endianness.
|
||||
- In aligned static mode with `maxLength`, the entire record is reserved
|
||||
at `maxLength` bytes (zero-padded).
|
||||
|
||||
|
||||
Reference in new issue
Block a user