Gathering detailed insights and metrics for @apidevtools/swagger-parser
Gathering detailed insights and metrics for @apidevtools/swagger-parser
Gathering detailed insights and metrics for @apidevtools/swagger-parser
Gathering detailed insights and metrics for @apidevtools/swagger-parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
npm install @apidevtools/swagger-parser
Typescript
Module System
Node Version
NPM Version
97.8
Supply Chain
100
Quality
88.4
Maintenance
100
Vulnerability
99.6
License
JavaScript (95.98%)
TypeScript (3.81%)
HTML (0.2%)
Total Downloads
238,289,054
Last Day
115,507
Last Week
2,261,845
Last Month
9,431,267
Last Year
93,639,354
MIT License
1,147 Stars
715 Commits
164 Forks
19 Watchers
2 Branches
32 Contributors
Updated on Jul 01, 2025
Minified
Minified + Gzipped
Latest Version
12.0.0
Package Id
@apidevtools/swagger-parser@12.0.0
Unpacked Size
54.41 kB
Size
12.98 kB
File Count
9
NPM Version
10.9.2
Node Version
24.2.0
Published on
Jun 16, 2025
Cumulative downloads
Total Downloads
Last Day
26.1%
115,507
Compared to previous day
Last Week
-4.8%
2,261,845
Compared to previous week
Last Month
0.3%
9,431,267
Compared to previous month
Last Year
47.5%
93,639,354
Compared to previous year
6
1
22
$ref
pointers, including external files and URLs$ref
pointers$ref
pointers, giving you a normal JavaScript object that's easy to work with$ref
pointers to the same value always resolve to the same object instance1SwaggerParser.validate(myAPI, (err, api) => { 2 if (err) { 3 console.error(err); 4 } else { 5 console.log("API name: %s, Version: %s", api.info.title, api.info.version); 6 } 7});
Or use async
/await
or Promise syntax instead. The following example is the same as above:
1try { 2 let api = await SwaggerParser.validate(myAPI); 3 console.log("API name: %s, Version: %s", api.info.title, api.info.version); 4} catch (err) { 5 console.error(err); 6}
For more detailed examples, please see the API Documentation
Install using npm:
1npm install @apidevtools/swagger-parser
When using Swagger Parser in Node.js apps, you'll probably want to use CommonJS syntax:
1const SwaggerParser = require("@apidevtools/swagger-parser");
When using a transpiler such as Babel or TypeScript, or a bundler such as Webpack or Rollup, you can use ECMAScript modules syntax instead:
1import * as SwaggerParser from "@apidevtools/swagger-parser";
Swagger Parser supports recent versions of every major web browser. Older browsers may require Babel and/or polyfills.
To use Swagger Parser in a browser, you'll need to use a bundling tool such as Webpack, Rollup, Parcel, or Browserify. Some bundlers may require a bit of configuration, such as setting browser: true
in rollup-plugin-resolve.
Full API documentation is available right here
The library, by default, attempts to resolve any files referenced using $ref
, without considering file extensions or the location of the files. This can result in Local File Inclusion (LFI), thus, potentially sensitive information disclosure. Developers must be cautious when working with documents from untrusted sources. See here for more details and information on how to mitigate LFI.
I welcome any contributions, enhancements, and bug-fixes. Open an issue on GitHub and submit a pull request.
To test the project locally on your computer:
Clone this repo
git clone https://github.com/APIDevTools/swagger-parser.git
Install dependencies
npm install
Run the tests
npm test
Check the code coverage
npm run coverage
Swagger Parser is 100% free and open-source, under the MIT license. Use it however you want.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work.
Thanks to these awesome companies for their support of Open Source developers ❤
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
18 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 6/27 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More