Embedded schema does not distinguish flags from enums
@naegelejd is already working on this.
Since Jul 1, 2026.
- Dominant language
- C++
- Stars
- 35
- Forks
- 14
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Description
Problem
The schema string that Yardl embeds in every binary/NDJSON file does not record whether an enum-like type is a !flags type. As a result, a !flags definition and an !enum definition are byte-for-byte identical in the embedded schema. Any consumer that works purely from the embedded schema (e.g. a dynamic/schema-only reader, or a third-party tool) cannot reproduce Yardl's own flags semantics, and cannot even reproduce Yardl's own NDJSON output for affected protocols.
Concrete differences between Yardl's SDK output and a schema-only reader on the models/test/unittests.yml protocols:
| Protocol | Yardl SDK | Schema-only reader |
|---|---|---|
Flags — MONDAY+WEDNESDAY+FRIDAY |
["monday","wednesday","friday"] |
21 |
Flags — SUNDAY |
["sunday"]` | "sunday" |
Enums — RecordWithEnums.flags |
[] |
0 |
Unions — [null, Fruits, DaysOfWeek] holding Fruits.APPLE |
"apple" (simple) |
{"T1":"apple"} (tagged) |
These are the only fidelity differences observed across all 29 protocols in unittests.yml; everything else round-trips byte-for-byte. (Discovered while prototyping a dynamic, schema-only binary reader.)
Proposed fix
Emit the flags marker in the protocol schema. Simplest is to give EnumDefinition a custom MarshalJSON (or add an isFlags field) so the embedded types[] carries it — mirroring the existing enum/flags distinction in TypeDefinitions.MarshalJSON.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.