Commit Graph

11 Commits

Author SHA1 Message Date
Ivan Krysak 2d618120e0 TTG: add default: value support
This also unifies `get_default_value` helper across all the target
languages.

Before this, there were two different versions of it for python
and typescript while c++ side didn't have one at all.
2025-10-13 18:33:10 +03:00
Ivan Krysak cc57e57fd1 TTG: remove support for optional: true fields
After this commit, every non-key field is treated as if it was optional
while every key field (plus every auto-generated `Kind` field) - as if
it was required.
2025-10-13 18:33:10 +03:00
Ivan Krysak 10ca432cb2 TTG: simplify reference field usage
This allows to avoid having to specify the `rootType` (stable within
the entire tree) manually each time a reference is introduced.
Thanks to that, a much nicer syntax of:
```yaml
- name: MyTypeField
  reference-to: TypeDefinition
```
can replace the current one:
```yaml
- name: MyTypeField
  reference:
    pointeeType: TypeDefinition
    rootType: Binary
```
2025-10-13 18:33:10 +03:00
Ivan Krysak 480443f358 TTG: drop upcastable: configuration option
Instead, detect whether `UpcastablePointer` wrapping is needed or not
based on the type.
2025-10-13 18:33:10 +03:00
Ivan Krysak e9bb8c43cf TTG: make sure emission order is stable
Debugging is a lot harder when you cannot just diff outputs of
the generator.

This commit ensures types are always emitted in the same order,
no matter the input schema ordering or the target language.
2025-10-13 18:33:10 +03:00
Ivan Krysak 38921fb85e TTG: drop an unnecessary TODO 2025-10-13 18:33:10 +03:00
Ivan Krysak f49ec25de3 TTG: make doc mandatory in structs and enums 2025-07-23 11:38:52 +02:00
Ivan Krysak b5337d78da Minor Improvements 2025-07-23 11:38:50 +02:00
Giacomo Vercesi 0a2cb4df12 TTG: move namespace to the cpp generator
The `namespace` property is strictly used just by the cpp generator.
Move the code so the `--namespace` option is exclusive to it and removed
for all the other generators.
2025-06-25 15:40:13 +02:00
Giacomo Vercesi d62b7b6b1a TTG: inline root type in schema
Move the root type inside the schema definition, as it is a property of
it and not of the generator.
2025-06-25 15:40:13 +02:00
Giacomo Vercesi d404fee38f Unify TTG CLI tool for generation
Merge all the command-line scripts for generating tuple-tree
implementations into a single `tuple-tree-generate.py` script. Move all
the other files a directory down.
2025-06-25 15:40:13 +02:00