Skip to content

docs(schema): mark DefaultOnNull lists with an x-deserialize hint - #2569

Merged
benbrandt merged 1 commit into
mainfrom
docs/default-on-null-lists
Oct 27, 2026
Merged

benbrandt merged 1 commit into
mainfrom
docs/default-on-null-lists

Conversation

@benbrandt

Copy link
Copy Markdown
Member

Some list fields use DefaultOnNull, which Rust accepts as empty, but the JSON schema showed them as plain non-nullable arrays with no hint. Examples: mcpServers, additionalDirectories, terminal auth args/env, and MCP args/env/headers. Schema-generated receivers rejected null while Rust accepted it.

This adds an x-deserialize-default-on-null schema hint to every DefaultOnNull field, alongside the existing x-deserialize-default-on-error and x-deserialize-skip-invalid-items hints. The leniency stays out of the spec prose, and null remains invalid for senders.

Applied to v1 and v2, since it's schema metadata only (27 fields).

@benbrandt
benbrandt requested a review from a team as a code owner October 27, 2026 21:37
@benbrandt
benbrandt enabled auto-merge (squash) October 27, 2026 21:38
@benbrandt
benbrandt merged commit 5a0a17b into main Oct 27, 2026
13 checks passed
@benbrandt
benbrandt deleted the docs/default-on-null-lists branch October 27, 2026 21:41
@acp-release-bot acp-release-bot Bot mentioned this pull request Oct 27, 2026
benbrandt added a commit that referenced this pull request Oct 28, 2026
#2571)

#2567 made v2 SessionInfo.additionalDirectories parse null as empty but
landed after #2569 added the x-deserialize-default-on-null hint, so the
field missed it. Generated parsers that read the hint (the TypeScript SDK)
then reject null there, and because session/list skips invalid entries, the
whole session drops out of the list instead of listing with no roots.

Add the hint and a schema-generator test, like the existing DefaultOnError
one, that fails when a DefaultOnNull field has no hint.

Co-authored-by: Claude <noreply@anthropic.com>
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