Distinct JSON enum values can sanitize to the same C++ identifier
(e.g. "foo-bar" and "foo_bar" both become `foo_bar`), producing an
invalid `enum class` with duplicate constants.
Add `unique_enum_identifiers()` which appends a numeric suffix to
later collisions while preserving enum declaration order, so the
index-to-JSON-value mapping used by the generated parser stays intact.
Also add contrib/schemagen/test_schemagen.py and wire the schemagen
Python tests plus the existing example.schema.json/test_gen.cpp example
into ctest via CMakeLists.txt.
Closes#4
Addresses review feedback: keep the schemagen-specific CMake rules
close to the tool instead of inline in the top-level CMakeLists.txt.
The subdirectory file is added from the root and guarded by the same
Python3 availability check that was already in use.
andrew
merged commit 644d244990 into main2026-06-18 20:01:09 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #4
595be0c338to359f4f4bb6@@ -170,6 +170,38 @@ if(Python3_Interpreter_FOUND)${CMAKE_CURRENT_SOURCE_DIR}/test_python_bindings.py)endif()# schemagen testsCan we put this in contrib/schemagen/CMakeLists.txt?