npm.io
0.1.4 • Published 2d ago

@counterfact/openapi

Licence
MIT
Version
0.1.4
Deps
5
Size
15 kB
Vulns
0
Weekly
0
Stars
169

@counterfact/openapi

Load, bundle, dereference, and apply ordered OpenAPI overlays without starting the Counterfact server, generator, or REPL.

import {
  applyOverlays,
  bundleOpenApiDocument,
  loadOpenApiDocument,
} from "@counterfact/openapi";

const dereferenced = await loadOpenApiDocument("./openapi.yaml", [
  "./development.overlay.yaml",
]);
const bundled = await bundleOpenApiDocument("./openapi.yaml");

await applyOverlays(dereferenced, ["./local.overlay.yaml"]);
void bundled;

loadOpenApiDocument resolves references completely. Use bundleOpenApiDocument when a consumer needs external references folded into one document while retaining internal references. Overlay paths are applied in the order provided.

See examples/load-local-spec.mjs for a complete public-import example.

Keywords