Skip to content

Distinguish booleans from strings in uniqueItems - #222

Open
muneikh wants to merge 1 commit into
horejsek:masterfrom
muneikh:fix-boolean-string-unique-items
Open

muneikh wants to merge 1 commit into
horejsek:masterfrom
muneikh:fix-boolean-string-unique-items

Conversation

@muneikh

@muneikh muneikh commented Oct 11, 2026

Copy link
Copy Markdown

uniqueItems normalizes booleans using str(), making true collide with the JSON string "True" (and false with "False"). Valid arrays such as [true, "True"] therefore fail validation. The same collision occurs inside nested arrays and objects.

Use a type-tagged boolean value in the existing normalization function. This keeps booleans distinct from strings and numbers while equal boolean values still compare equal. Regression tests cover both booleans, nested arrays/objects, and numeric distinction controls under drafts 04, 06 and 07.

Validation: 18 new cases fail before the change; the complete non-benchmark suite passes after it (625 passed, 4 skipped, 12 deselected) on Python 3.13. Pylint 4.1 reports the same nine diagnostics and 9.90/10 score as an untouched checkout; git diff --check passes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant