npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@polygonlabs/spol-api-schemas

v1.0.1

Published

Zod response schemas, OpenAPI registry, and committed spec for the sPOL REST API

Downloads

463

Readme

spol-api-schemas

Zod schemas, the OpenAPI registry, and the committed openapi.json for the sPOL REST API — the single source of truth for the API contract.

Three consumers read this one contract, so they can never drift out of sync:

  • The service (@polygonlabs/spol-rest-api) validates requests against these schemas and serves the generated spec at /openapi.json.
  • The generated client (@polygonlabs/spol-api-client) is codegen'd from the same openapi.json and imports these exact Zod values, so it validates against precisely what the backend accepts.
  • The spec artifact (openapi.json) is committed and regenerated on build, so a schema change that isn't reflected in the spec fails the codegen-drift-check gate rather than shipping silently.

Codec-typed fields (BigIntegerCodec, IsoDateCodec from @polygonlabs/zod-codecs) carry a wire type distinct from their runtime type — a wei amount is a decimal string on the wire and a bigint after parsing — so the client decodes to the right runtime type end-to-end without a parallel schema.

Install

pnpm add @polygonlabs/spol-api-schemas

Entry points

| Entry point | Contents | | ------------------------------------ | -------------------------------------------------------------------------------------------- | | @polygonlabs/spol-api-schemas | The Zod schemas — registered response components and the shared building blocks / query shapes | | @polygonlabs/spol-api-schemas/registry | buildRegistry() — the @asteasolutions/zod-to-openapi registry that drives both openapi.json generation and the client codegen | | @polygonlabs/spol-api-schemas/openapi.json | The committed OpenAPI 3.0 document (regenerated on build) |

Naming convention

Schemas registered as OpenAPI components (.openapi('Name')) are exported under the registered name verbatim (Transaction, SummaryResponse, TransactionsListV1Response, …) — the @polygonlabs/zod-to-openapi-heyapi codegen imports them by that name and audits the export at build time, so renaming one breaks the generated client. Building blocks that are not registered components (NetworkSchema, AddressSchema, query/filter shapes) keep the *Schema suffix to distinguish them at call sites.

Development

pnpm --filter @polygonlabs/spol-api-schemas run build       # typecheck, emit dist/, regenerate openapi.json
pnpm --filter @polygonlabs/spol-api-schemas run test        # codec round-trip tests

openapi.json is generated from the registry by scripts/generate-spec.ts; never hand-edit it. See apps-team-ops/docs/best-practices/rest-api-clients-codegen.md for the full contract-first pattern.