schemagen: drop support for additionalProperties: true #28

Merged
andrew merged 2 commits from weaselbot/weaseljson:weaselbot/issue-20 into main 2026-06-23 20:57:00 +00:00
Member

Closes #20

Following review feedback, the generator no longer supports permissive objects.

  • Reject additionalProperties: true at generation time.
  • Treat an absent additionalProperties as false, so every object is strict by default and unknown keys are rejected during parsing.
  • Remove the now-dead permissive-object infrastructure: Kind::Skip, Cat::Skip, kSkip, the per-frame unknown key set, and isStrict().
  • Update the README feature/rejection tables.
  • Remove the permissive "loose" object from example.schema.json and the associated tests from test_gen.cpp.
  • Add Python unit tests verifying the new additionalProperties behavior.

All tests pass (ctest --output-on-failure).

Closes #20 Following review feedback, the generator no longer supports permissive objects. - Reject `additionalProperties: true` at generation time. - Treat an absent `additionalProperties` as `false`, so every object is strict by default and unknown keys are rejected during parsing. - Remove the now-dead permissive-object infrastructure: `Kind::Skip`, `Cat::Skip`, `kSkip`, the per-frame `unknown` key set, and `isStrict()`. - Update the README feature/rejection tables. - Remove the permissive "loose" object from `example.schema.json` and the associated tests from `test_gen.cpp`. - Add Python unit tests verifying the new `additionalProperties` behavior. All tests pass (`ctest --output-on-failure`).
andrew requested changes 2026-06-23 17:48:02 +00:00
andrew left a comment
Owner

Drop support for additionalProperties = true

Drop support for additionalProperties = true
weaselbot changed title from schemagen: reject duplicate unknown keys in non-strict objects to schemagen: drop support for additionalProperties: true 2026-06-23 18:07:49 +00:00
weaselbot added 2 commits 2026-06-23 19:12:17 +00:00
Track unknown keys in a per-object unordered_set so that permissive
objects (additionalProperties absent/true) still reject duplicate keys,
matching the README guarantee.

- Add std::unordered_set<std::string> to Frame.
- Insert unknown keys in cbKeyData and reject duplicates before skipping.
- Add a permissive "loose" subobject to example.schema.json.
- Test single unknown key accepted and duplicate unknown/known keys rejected.
schemagen: drop support for additionalProperties: true
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64, true) (pull_request) Successful in 52s
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 48s
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 1m24s
16f13c241c
Following review feedback, the generator no longer supports permissive
objects. Changes:

- Reject `additionalProperties: true` at generation time.
- Treat an absent `additionalProperties` as `false`, so every object is
  strict by default and unknown keys are rejected during parsing.
- Remove the now-dead permissive-object infrastructure: `Kind::Skip`,
  `Cat::Skip`, `kSkip`, the per-frame `unknown` key set, and `isStrict()`.
- Update the README feature/rejection tables accordingly.
- Remove the permissive "loose" object from example.schema.json and the
  associated tests from test_gen.cpp.
- Add Python unit tests verifying the new `additionalProperties` behavior.

All tests pass (`ctest --output-on-failure`).
weaselbot force-pushed weaselbot/issue-20 from 414abca9c0 to 16f13c241c 2026-06-23 19:12:17 +00:00 Compare
andrew merged commit ceb4bc1041 into main 2026-06-23 20:57:00 +00:00
andrew deleted branch weaselbot/issue-20 2026-06-23 20:57:00 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weaselab/weaseljson#28