Gathering detailed insights and metrics for swagger-parser
Gathering detailed insights and metrics for swagger-parser
Gathering detailed insights and metrics for swagger-parser
Gathering detailed insights and metrics for swagger-parser
@apidevtools/swagger-parser
Swagger 2.0 and OpenAPI 3.0 parser and validator for Node and browsers
@buda.com/openapi-resolver-github-cli
A resolver for swagger-parser
@swagger-api/apidom-parser-adapter-api-design-systems-json
Parser adapter for parsing JSON documents into API Design Systems namespace.
@swagger-api/apidom-parser-adapter-openapi-json-3-1
Parser adapter for parsing JSON documents into OpenAPI 3.1.x namespace.
npm install swagger-parser
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,108 Stars
689 Commits
156 Forks
19 Watching
6 Branches
28 Contributors
Updated on 14 Nov 2024
JavaScript (91.02%)
SCSS (3.51%)
HTML (2.88%)
TypeScript (2.59%)
Cumulative downloads
Total Downloads
Last day
-20.7%
170,178
Compared to previous day
Last week
-1.1%
971,638
Compared to previous week
Last month
10.5%
4,153,851
Compared to previous month
Last year
7.5%
40,466,254
Compared to previous year
1
$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 } 5 else { 6 console.log("API name: %s, Version: %s", api.info.title, api.info.version); 7 } 8});
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} 5catch(err) { 6 console.error(err); 7}
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
I welcome any contributions, enhancements, and bug-fixes. Open an issue on GitHub and submit a pull request.
To build/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 build script
npm run build
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. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
Thanks to these awesome companies for their support of Open Source developers ❤
No vulnerabilities found.
Reason
15 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
Found 5/11 approved changesets -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
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 2024-11-25
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