Skip to content

Add deprecated target aliases to toJSONSchema types#5659

Open
mattrossman wants to merge 1 commit intocolinhacks:mainfrom
mattrossman:feat/add-deprecated-target-aliases
Open

Add deprecated target aliases to toJSONSchema types#5659
mattrossman wants to merge 1 commit intocolinhacks:mainfrom
mattrossman:feat/add-deprecated-target-aliases

Conversation

@mattrossman
Copy link

Adds "draft-4" and "draft-7" in the target types for z.toJSONSchema().

These aliases are already supported at runtime via normalization but were not discoverable via TypeScript autocomplete.

if (normalizedTarget === "draft-4") normalizedTarget = "draft-04";
if (normalizedTarget === "draft-7") normalizedTarget = "draft-07";

Rationale is we target "draft-07" in @supabase/mcp-server-supabase but consume this package from apps that use both 4+ and 3.25+ Zod versions.
https://github.com/supabase-community/supabase-mcp/blob/f4c1a1f2a7a839ecc75e9bdc92832f2144689c76/packages/mcp-utils/src/server.ts#L445

This unknowingly introduced runtime errors for apps that use the older v4 Zod APIs that don't recognize "draft-07". We'd like to instead target "draft-7" which is supported in both versions, but not clear from the types.

Copy link
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Minor, non-blocking: this is a straightforward type addition that exposes already-supported runtime aliases to TypeScript autocomplete. The motivation is clear and the implementation is correct.

Pullfrog  | View workflow runpullfrog.com𝕏

@pullfrog
Copy link
Contributor

pullfrog bot commented Jan 24, 2026

Review Complete ✅

Reviewed the PR and approved. The change correctly exposes existing runtime aliases ("draft-4" and "draft-7") to TypeScript autocomplete—straightforward and well-motivated.

Pullfrog  | Triggered by Pullfrog | Using Claude CodeView workflow runpullfrog.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