Converts OpenAPI YAML files (OpenAPI 3.0, Swagger 2) into ES6 modules for Rollup and Vite. Version 3.0.1 ships TypeScript definitions, supports `$ref` resolution, and works with Vite's HMR. Different from general YAML loaders: it parses OpenAPI spec, validates, and produces structured code module. Requires Node >=18. Released on JSR as well. Actively maintained with frequent releases based on CI.
npm install rollup-plugin-openapiVerified import paths — ran on the pinned version, not inferred.
Rollup config that imports OpenAPI YAML files as ES modules with include/exclude options.
Upgrade Node.js to v18 or later.
Create a .d.ts file with `/// <reference types="rollup-plugin-openapi/types/yaml" />`
Use `npm install rollup-plugin-openapi` instead of jsr install.
Inline remote references or download them locally before build.
Run `npm install --save-dev rollup-plugin-openapi` and ensure no typo in import.
Use `import openapi from 'rollup-plugin-openapi'` (no braces).
Create a .d.ts file with `/// <reference types="rollup-plugin-openapi/types/yaml" />`
Remove braces: `import openapi from 'rollup-plugin-openapi'`