schemagen: support objects with more than 32 properties
Replace the 32-bit `uint32_t seen` bitmask with a `std::vector<uint64_t>` bitset sized to the actual field count. `requiredMask` is now a vector of the same word count, and required-field checks use per-word masking so that optional fields do not cause false rejections. Adds big.schema.json + test_big.cpp regression tests covering the issue reproducer (40 required properties, missing/duplicate at index 32), plus run_tests.sh to exercise both test_gen.cpp and test_big.cpp. Fixes #3
This commit is contained in:
@@ -73,3 +73,18 @@ union `type` lists other than `["T", "null"]`, non-string enums, and remote
|
||||
cannot hold partial digits.
|
||||
- `test_gen.cpp` generates from `example.schema.json` and exercises the parser
|
||||
byte-by-byte (covering chunked strings/numbers), plus the rejection cases.
|
||||
|
||||
## Testing
|
||||
|
||||
After building weaseljson (e.g. `cmake -S . -B build && make -C build`), run:
|
||||
|
||||
```sh
|
||||
cd contrib/schemagen
|
||||
./run_tests.sh
|
||||
```
|
||||
|
||||
This regenerates the example parser (`gen.h`) and a regression parser with 40
|
||||
required properties (`big.h`), compiles `test_gen.cpp` and `test_big.cpp`, and
|
||||
runs both. `test_big.cpp` specifically covers issue #3: it checks that a
|
||||
40-property object accepts all fields, rejects a missing field at index 32, and
|
||||
rejects duplicate keys around the 32-bit boundary.
|
||||
|
||||
Reference in New Issue
Block a user