fix(postgrest): accept CLI-generated types in insert/upsert/update - #1613
Open
twelfthlabor wants to merge 1 commit into
Open
fix(postgrest): accept CLI-generated types in insert/upsert/update#1613twelfthlabor wants to merge 1 commit into
twelfthlabor wants to merge 1 commit into
Conversation
insert/upsert/update typed their body as JSON, so CLI-generated TypedDicts with datetime/date/time/UUID/Decimal fields failed type checking. Widening the alias alone is not enough: httpx serializes json= with stdlib json.dumps, which raises TypeError on those values at runtime. Add a JSONSerializable input alias (strict JSON type left unchanged for response validation) and normalize outbound bodies to JSON-safe primitives via pydantic in RequestConfig, keeping the httpx request path as-is. Fixes supabase#1443
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: insert/upsert/update type their body as JSON, so CLI-generated TypedDicts with datetime/date/time/UUID/Decimal fields fail type checking (#1443). Widening the alias alone is not sufficient: httpx serializes json= with stdlib json.dumps, which raises TypeError on those values at request time.
Fix:
Tests: insert/upsert/update with datetime, date, time, UUID, and Decimal values, plus TypedDict validation and a plain-JSON unchanged case, in both sync and async suites. ruff and mypy clean.
Fixes #1443