Repository navigation
[TS SDK] Consolidate the duplicate sort and pagination param schemas #1130
Description
Summary
SortQueryParamsSchema and SortBodyParamsSchema (sorting.ts:23 and :39) have identical shapes. Same for PaginatedQueryParamsSchema and PaginatedBodyParamsSchema. The split adds no type safety.
One caveat to resolve first: if we auto-generate schemas from TypeSpec later, a single shared schema may be hard to maintain. Zod does not distinguish query from body params, but TypeSpec does. Consolidating in Zod without a matching approach in the core library could create drift.
Acceptance criteria
- The TypeSpec query-vs-body distinction is evaluated, and the approach either consolidates in the core library too or documents why the SDK can diverge
- Each query/body pair shares one internal schema definition, or a concrete validation difference is implemented and tested to justify separate definitions
- The existing query and body schema exports remain available and continue to pass parity tests against their corresponding generated TypeSpec schemas
- Any Core or TypeScript SDK changes resulting from the decision are included in the
[Core] v0.6.0 releaseand[TS SDK] v0.10.0 releasecandidates, respectively
Release coordination
This ticket may affect Core and the TypeScript SDK. GitHub allows only one milestone per issue, so [Core] v0.6.0 release is the primary planning milestone and [TS SDK] v0.10.0 release is the coordinated secondary release. If the decision does not require Core consolidation or a public SDK behavior change, one or both releases may not be necessary; update the milestone and release implications to match the recorded decision before closing the ticket.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
SnowboardTechie commentedon Sep 10, 2026
Worth folding one more pagination-schema fix in here, since it's the same file and the same breaking release.
PaginatedResultsInfoSchema.pageSizeismin(0)in pagination.ts, with a comment saying 0 is for empty pages. That came in with #522. Core pagination.tsp requirespageSize >= 1on responses, and every implementation I checked (Express template, simpler-grants-gov, and now the Hono template after cg-api-template-hono#1) reports the requested page size, not the item count. So the SDK is the outlier, and the current parity test can't see it because it only samples protocol-valid values.Proposed extra checkbox:
PaginatedResultsInfoSchema.pageSizeis restored tomin(1)to match core, with a regression that fails onpageSize: 0and still accepts a valid empty page (items: [],pageSize: <requested>,totalItems: 0)This is breaking for any client whose server emits
pageSize: 0, so it fits the[TS SDK] v0.10.0release this ticket already targets. No Core change needed for this part.test(ts-sdk): point the page int32 divergence at #1196, its owning Co…
test(ts-sdk): point the page int32 divergence at #1196, its owning Co…
test(ts-sdk): give models, pagination, and responses boundary cases
fix(ts-sdk): catch permissive schema drift and empty parity-test runs (…