Skip to content

[Core] Use integer, not int32, for pagination fields #1196

Description

@SnowboardTechie

Summary

Every count in Core is integer (e.g. OppFunding.minAwardCount) except in lib/core/lib/core/pagination.tsp; the only other int32 in the library is the HTTP status code on the response models, which is correctly int32 and out of scope here. Inside the module the width is applied inconsistently: PaginatedResultsInfo.page is int32 while its siblings pageSize, totalItems, and totalPages are integer, and the request models use int32 for both page and pageSize.

The emitters turn that one int32 into a contract nothing else honors. The JSON Schema emitter writes maximum: 2147483647 on page and on no other pagination field; the OpenAPI emitter writes format: int32. No implementation or tool reads either: cg check spec compares type, enum, properties, required, and items only; the Express, FastAPI, and Hono templates and simpler-grants-gov all validate page as an unbounded or safe integer; the TypeScript SDK's z.number().int() accepts up to 2⁵³−1 and the Python SDK's int is unbounded. The bound exists only in the spec text.

The #1193 parity harness (PR #1195) now surfaces this as a tracked divergence — page: 2147483648 is accepted by the TypeScript SDK and rejected by the protocol — and requires that entry to name the issue that owns the fix. This is that issue. The fix is in Core, not the SDK: widen page to integer so the module is uniform and the divergence disappears.

Change every int32 in pagination.tsp to integer: page and pageSize on PaginatedQueryParams and PaginatedBodyParams, and page on PaginatedResultsInfo. Widening an accepted domain is non-breaking for every existing consumer.

Acceptance criteria

  • No int32 remains in lib/core/lib/core/pagination.tsp; page and pageSize on the request models and page on PaginatedResultsInfo are integer. The response models' status: int32 (HTTP status codes) is unchanged.
  • The emitted JSON Schema for those fields carries minimum: 1 and no maximum; the emitted OpenAPI carries no format: int32.
  • Previously published Core versions (0.1.0 through 0.4.0) emit unchanged; the wider type applies from the next Core version (@typeChangedFrom or equivalent — Core has not versioned a type change before, so record the approach in the PR).
  • The TypeScript SDK parity harness reflects the fix in the same PR: the page: 2147483648 divergent entry in lib/ts-sdk/__tests__/schemas/zod/pagination.spec.ts is removed (the harness fails demanding removal once the schemas agree) and the same value is re-added as an ordinary agree case, with the knownDivergences assertion updated. Touching lib/ts-sdk/__tests__/ also triggers ci-lib-ts-sdk.yml, which a Core-only change would not.

Evidence and scope

  • pagination.tsp: the seven int32 declarations and the three integer siblings. funding.tsp: the integer precedent for counts.
  • check-schema-compatibility.ts: the compliance checker never reads format, minimum, or maximum, so this change cannot fail any implementation's cg check spec.
  • TypeScript SDK pagination.ts: z.number().int().min(1) — Zod 4 safe-integer semantics, already the correct encoding of integer for JavaScript. No SDK production change is needed, in TypeScript or Python.
  • ci-lib-ts-sdk.yml: path-filtered to lib/ts-sdk/**, hence the requirement that the PR touch the harness test.
  • The pageSize >= 1 restoration on PaginatedResultsInfoSchema stays with [TS SDK] Consolidate the duplicate sort and pagination param schemas #1130; this issue owns integer width only. The TypeScript SDK's 2⁵³−1 cap is a JavaScript platform fact, not a divergence to track.

Activity

  1. added
    sdkIssue or PR related to our SDKs
    typescriptIssue or PR related to TypeScript tooling
    ts-sdkRelated to TypeScript SDK
    fixFix to the published version. Goes straight to main.
    on Sep 15, 2026
  2. added a commit that references this issue on Sep 15, 2026
  3. added a commit that references this issue on Sep 15, 2026
  4. added
    breakingChange that breaks the published API. Belongs on a hold branch.
    and removed
    fixFix to the published version. Goes straight to main.
    on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

breakingChange that breaks the published API. Belongs on a hold branch.coreIssues related to @common-grants/core librarysdkIssue or PR related to our SDKsts-sdkRelated to TypeScript SDKtypescriptIssue or PR related to TypeScript tooling

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions