Skip to content

fix: reject nulls in non-sparse collections - #374

Open
jterapin wants to merge 1 commit into
mainfrom
fix-sparse-deserialization
Open

jterapin wants to merge 1 commit into
mainfrom
fix-sparse-deserialization

Conversation

@jterapin

@jterapin jterapin commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Description

Non-sparse collections must not contain null values, but the JSON and CBOR deserializers silently discard them.

  • Null list elements are removed instead of rejected.
  • Null map values cause the entire entry to be removed instead of rejected.

Fix

Raise the codec-specific ParseError for null values in non-sparse collections while continuing to retain null values in collections marked with @sparse.

raise ParseError if value.nil? && !sparse

Testing

1,240 examples, 0 failures, and 2 existing pending examples using Ruby 4.0.4.


🤖 This PR description was drafted with AI assistance and reviewed by @jterapin. ✨

@jterapin
jterapin marked this pull request as ready for review October 2, 2026 03:53
@jterapin
jterapin requested a review from a team as a code owner October 2, 2026 03:53
@jterapin
jterapin force-pushed the fix-sparse-deserialization branch from 1b1cc6a to 7c59e39 Compare October 2, 2026 20:37
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