@polygonlabs/api-gateway-schemas
v2.2.0
Published
Zod response schemas, OpenAPI registry, and committed spec for the Polygon API Gateway
Keywords
Readme
@polygonlabs/api-gateway-schemas
Zod response schemas, the OpenAPI registry, and the committed openapi.json
spec for the Polygon API Gateway's typed surface — the single source of truth
for that API surface, published so consumers can validate responses against
the exact constraints the server enforces.
Why this package exists
The gateway routes and validates its typed endpoints against an OpenAPI
registry composed from these Zod schemas, openapi.json is generated from
that same registry, and
@polygonlabs/api-gateway-client
is generated from that spec — so server, spec, and client cannot silently
drift apart.
Publishing the schemas extends that guarantee to consumers: anything you
validate with these exports is checked by the actual runtime schemas the
backend executes — codecs, refinements, and constraints included — not types
re-derived from a lossy OpenAPI round-trip. If you just want a typed client,
use @polygonlabs/api-gateway-client, which wires this up for you.
Install
pnpm add @polygonlabs/api-gateway-schemasEntry points
@polygonlabs/api-gateway-schemas— every registered schema, exported under its OpenAPI registered name (e.g.ScreenAddressResponse,ScreenableAddress), plus the address-kind helpers (detectAddressKind,normalizeAddress).@polygonlabs/api-gateway-schemas/registry—buildRegistry(), the typed OpenAPI registry composing every route registration.@polygonlabs/api-gateway-schemas/openapi.json— the committed OpenAPI document (also served live at/api/openapi.jsonby the gateway).
