The generated builder only tracks populated fields (seen) for keys that match the schema. Unknown keys are marked as kSkip and never update the bitset. As a result, when additionalProperties is not false, the same unknown key can appear multiple times without triggering the duplicate-key rejection that the README documents.
Relevant generator code in contrib/schemagen/weaseljson_schemagen.py:
Lines 955-972 (cbKeyData template): duplicate-key check at lines 968-970 only runs for matched (idx >= 0) keys; unknown keys go to the skip branch at lines 963-966 without recording anything.
Lines 906-916 (valueComplete): the seen bitset is only updated for matched fields (p.field >= 0).
The README lists "duplicate object keys" as a schema violation, and the existing test_gen.cpp checks duplicate matched keys. Duplicate unknown keys currently bypass that check.
Impact: the generated parser does not enforce the documented duplicate-key policy for permissive objects, which can mislead callers that rely on the builder for JSON validation.
The generated builder only tracks populated fields (`seen`) for keys that match the schema. Unknown keys are marked as `kSkip` and never update the bitset. As a result, when `additionalProperties` is not `false`, the same unknown key can appear multiple times without triggering the duplicate-key rejection that the README documents.
Relevant generator code in `contrib/schemagen/weaseljson_schemagen.py`:
- Lines 955-972 (`cbKeyData` template): duplicate-key check at lines 968-970 only runs for matched (`idx >= 0`) keys; unknown keys go to the skip branch at lines 963-966 without recording anything.
- Lines 906-916 (`valueComplete`): the `seen` bitset is only updated for matched fields (`p.field >= 0`).
Schema:
```json
{
"type": "object",
"properties": { "known": { "type": "string" } }
}
```
Input: `{"unknown":1,"unknown":2}`
- Actual: `WeaselJson_OK` (the object is accepted).
- Expected: `WeaselJson_REJECT` (duplicate object key).
The README lists "duplicate object keys" as a schema violation, and the existing `test_gen.cpp` checks duplicate matched keys. Duplicate unknown keys currently bypass that check.
Impact: the generated parser does not enforce the documented duplicate-key policy for permissive objects, which can mislead callers that rely on the builder for JSON validation.
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.
The generated builder only tracks populated fields (
seen) for keys that match the schema. Unknown keys are marked askSkipand never update the bitset. As a result, whenadditionalPropertiesis notfalse, the same unknown key can appear multiple times without triggering the duplicate-key rejection that the README documents.Relevant generator code in
contrib/schemagen/weaseljson_schemagen.py:cbKeyDatatemplate): duplicate-key check at lines 968-970 only runs for matched (idx >= 0) keys; unknown keys go to the skip branch at lines 963-966 without recording anything.valueComplete): theseenbitset is only updated for matched fields (p.field >= 0).Schema:
Input:
{"unknown":1,"unknown":2}WeaselJson_OK(the object is accepted).WeaselJson_REJECT(duplicate object key).The README lists "duplicate object keys" as a schema violation, and the existing
test_gen.cppchecks duplicate matched keys. Duplicate unknown keys currently bypass that check.Impact: the generated parser does not enforce the documented duplicate-key policy for permissive objects, which can mislead callers that rely on the builder for JSON validation.
We should drop support for
additionalProperties = true