Skip to content

Fix REST API validation failures for omitted fields#1115

Merged
rasmi merged 1 commit into
PAIR-code:mainfrom
rasmi:optional-types
May 12, 2026
Merged

Fix REST API validation failures for omitted fields#1115
rasmi merged 1 commit into
PAIR-code:mainfrom
rasmi:optional-types

Conversation

@rasmi
Copy link
Copy Markdown
Collaborator

@rasmi rasmi commented May 12, 2026

Commit f27f7fc introduced strict TypeBox Value.Check validation for REST API endpoints. This caused Python client payloads (which omit fields rather than explicitly sending null due to Pydantic's exclude_none=True) to be rejected with Expected union value 400 errors for any fields defined strictly as Type.Union([Type.Null(), ...]).

This commit fixes the mismatch by wrapping all nullable TypeBox schemas in Type.Optional(), allowing clients to perform partial updates or omit empty fields cleanly while maintaining strict runtime typing.

@rasmi rasmi enabled auto-merge May 12, 2026 20:25
@cjqian cjqian self-requested a review May 12, 2026 21:35
@rasmi rasmi merged commit a4a9a11 into PAIR-code:main May 12, 2026
6 checks passed
@jimbojw
Copy link
Copy Markdown
Collaborator

jimbojw commented May 13, 2026

I created #1118 to track the upstream problem. Is there an easy way to test for this at PR time? I believe we already run Firebase emulators for testing the functions. We should be able to also exercise the Python CLI at this time.

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.

3 participants