A TypeScript utility for resolving $ref
in OpenAPI YAML routes, generating new YAML files without $ref
, ready for OpenAPI processing.
-
$ref Resolution: Automatically resolves
$ref
within OpenAPI YAML routes. - YAML Processing: Reads and writes YAML files seamlessly.
- TypeScript Support: Fully typed and written in TypeScript.
- Easy Integration: Simple API for integrating into existing projects.
You can install the package using npm:
npm install openapi-ref-resolver
Or with yarn:
yarn add openapi-ref-resolver
Here’s an example of how to use the resolveRefsInRoutes function:
import { resolveRefsInRoutes } from 'openapi-ref-resolver';
const inputFilePath = '/absolute/path/to/your/input.yaml';
const outputFilePath = '/absolute/path/to/your/output.yaml';
resolveRefsInRoutes(inputFilePath, outputFilePath);