Skip to content

json: reject null elements in closed enum containers - #594

Merged
iainmcgin merged 6 commits into
anthropics:mainfrom
fallintoplace:fix/json-closed-enum-null-elements
Oct 12, 2026
Merged

iainmcgin merged 6 commits into
anthropics:mainfrom
fallintoplace:fix/json-closed-enum-null-elements

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Reject null entries in closed enum lists and maps.

Why

  • {"tiers":[null]} was accepted as the default enum value.
  • ProtoJSON rejects null elements.

Implementation

  • Return a malformed-value error from the shared decoder.
  • Keep whole-field null handling.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@iainmcgin

Copy link
Copy Markdown
Collaborator

[claude code] Thanks for the fix and for testing it through proto2, editions and the no_std path. #691 edited the next line of the same function and has merged, so this branch needed a merge. Maintainer commits on top of yours: merges of main, with the one conflict resolved by keeping your null arm and the unknown-name wording from #691, and a changelog commit that puts the fragment in the house format with the PR number and adds a sentence saying that open-enum lists and maps still read a null element as 0. That open-enum half is tracked as a follow-up and is not part of this PR. Your code and tests are unchanged apart from the conflict resolution.

@iainmcgin
iainmcgin enabled auto-merge October 12, 2026 20:12
@iainmcgin
iainmcgin added this pull request to the merge queue Oct 12, 2026
Merged via the queue into anthropics:main with commit e166e1b Oct 12, 2026
11 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants