schemagen: reserve generated Root/Skip/RootScalar and avoid Kind/ArrN collisions #27

Merged
andrew merged 1 commits from weaselbot/weaseljson:weaselbot/issue-21 into main 2026-06-23 17:48:57 +00:00
Member

Closes #21.

  • Reserve Root, Skip, and RootScalar in Builder.unique_name() so user $defs names can no longer collide with the generated root type alias or fixed Kind enumerators.
  • Allocate array-kind names (Arr0, Arr1, ...) only after checking existing object/enum names so the Kind enum never contains duplicates.
  • Add regression tests that also syntax-check the generated headers with a C++ compiler.
Closes #21. - Reserve `Root`, `Skip`, and `RootScalar` in `Builder.unique_name()` so user `$defs` names can no longer collide with the generated root type alias or fixed `Kind` enumerators. - Allocate array-kind names (`Arr0`, `Arr1`, ...) only after checking existing object/enum names so the `Kind` enum never contains duplicates. - Add regression tests that also syntax-check the generated headers with a C++ compiler.
weaselbot added 1 commit 2026-06-23 16:23:24 +00:00
schemagen: reserve generated Root/Skip/RootScalar and avoid Kind/ArrN collisions
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64, true) (pull_request) Successful in 53s
CI / pre-commit (pull_request) Successful in 51s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64, false) (pull_request) Successful in 49s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64, true) (pull_request) Successful in 1m29s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64, false) (pull_request) Successful in 1m25s
46ff8e2164
Make the type-name allocator aware of the identifiers the generator emits
itself (`Root` alias, `Skip`/`RootScalar` Kind enumerators) so user `$defs`
names can no longer collide with them.  Array-kind names (`Arr0`, `Arr1`, ...)
are now allocated only after checking for object/enum names, preventing
duplicate `Kind` enumerators when a schema defines e.g. `Arr0`.

Add Python regression tests that also syntax-check the generated headers
with a C++ compiler.

Closes #21
weaselbot changed title from WIP: schemagen reserve generated names to schemagen: reserve generated Root/Skip/RootScalar and avoid Kind/ArrN collisions 2026-06-23 16:23:36 +00:00
andrew merged commit e8830e27e9 into main 2026-06-23 17:48:57 +00:00
andrew deleted branch weaselbot/issue-21 2026-06-23 17:48:58 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weaselab/weaseljson#27