JSPM

@aahoughton/oav

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 151
  • Score
    100M100P100Q111863F
  • License MIT

HTTP-aware OpenAPI request/response validator. Batteries-included distribution: re-exports @aahoughton/oav-core, adds YAML readers, ships the `oav` CLI. For a zero-runtime-dep install, use @aahoughton/oav-core directly.

Package Exports

  • @aahoughton/oav
  • @aahoughton/oav/core
  • @aahoughton/oav/formats
  • @aahoughton/oav/package.json
  • @aahoughton/oav/schema
  • @aahoughton/oav/schema/internals
  • @aahoughton/oav/spec
  • @aahoughton/oav/validator/internals

Readme

oav

Batteries-included distribution of @aahoughton/oav-core. Adds YAML readers and the oav CLI on top of the lean validator package; the programmatic surface is identical.

import { createValidator, createYamlFileReader } from "@aahoughton/oav";
import { loadSpec } from "@aahoughton/oav/spec";

const { document } = await loadSpec({
  reader: createYamlFileReader(),
  entry: "openapi.yaml",
});
const validator = createValidator(document);

When to use which

Package When to use
@aahoughton/oav Includes YAML readers and the oav CLI binary. Pulls in yaml, commander, and esbuild (CLI-only).
@aahoughton/oav-core Lean. Zero runtime dependencies. JSON specs only (or pre-parsed objects via the memory reader). Use on Cloudflare Workers, Vercel Edge, Lambda@Edge, or anywhere the YAML/CLI footprint isn't worth it.

oav re-exports every subpath of oav-core at matching paths (oav/schema, oav/spec, oav/formats, oav/core, oav/schema/internals, oav/validator/internals). Code written against one swaps to the other by changing the package name in imports — no surface changes.

What this package adds

  • createYamlFileReader() — file reader for .yaml / .yml paths. Calling oav-core's createFileReader() on a YAML path throws an install-hint pointing here.
  • createSmartHttpReader() — HTTP reader that parses both JSON and YAML by inspecting Content-Type / file extension.
  • parseYamlString(source) — exposed for callers loading YAML out-of-band (e.g. fetched from a config service).
  • The oav CLI binaryoav resolve, oav validate, oav compile-schema, oav compile-spec. See packages/cli/README.md for commands and flags.

Everything else (createValidator, compileSchema, error helpers, formatters, summarize, toProblemDetails, HTTP-status helpers, …) is re-exported from oav-core. Documentation for those lives in:

Framework integration

oav is a validator, not a middleware package. Companion adapter packages cover the framework wiring: oav-express4, oav-express5, oav-fastify. See INTEGRATION.md for adapter recipes plus manual integration patterns for Next.js, Hono, Bun, and Deno via the Web Standards adapter.

See also