Swagger Parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
Alternatives To Swagger Parser
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Fastapi62,8271382,21916 hours ago175July 27, 2023519mitPython
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Swagger Ui24,4781,6223702 days ago251July 24, 2023999apache-2.0JavaScript
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Redoc20,976112823 days ago217September 13, 2022318mitTypeScript
📘 OpenAPI/Swagger-generated API Reference Documentation
Grpc Gateway16,0586,619a day ago395July 28, 2023115bsd-3-clauseGo
gRPC to JSON proxy generator following the gRPC HTTP spec
Swagger Codegen15,9823162 days ago45May 17, 20233,378apache-2.0Mustache
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Full Stack Fastapi Postgresql12,908
13 days ago230mitPython
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Go Swagger8,8635419417 days ago91June 10, 2023625apache-2.0Go
Swagger 2.0 implementation for go
Swag8,832741,2002 days ago140May 04, 2023264mitGo
Automatically generate RESTful API documentation with Swagger 2.0 for Go.
Swagger Editor8,342135373 days ago317August 04, 2023216apache-2.0JavaScript
Swagger Editor
Swagger Core7,2623102343 days ago39May 15, 2023755apache-2.0Java
Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
Alternatives To Swagger Parser
Select To Compare


Alternative Project Comparisons
Readme

Swagger 2.0 and OpenAPI 3.0 parser/validator

Build Status Coverage Status Tested on APIs.guru

npm Dependencies License Buy us a tree

OS and Browser Compatibility

Online Demo

Features

  • Parses Swagger specs in JSON or YAML format
  • Validates against the Swagger 2.0 schema or OpenAPI 3.0 Schema
  • Resolves all $ref pointers, including external files and URLs
  • Can bundle all your Swagger files into a single file that only has internal $ref pointers
  • Can dereference all $ref pointers, giving you a normal JavaScript object that's easy to work with
  • Tested in Node.js and all modern web browsers on Mac, Windows, and Linux
  • Tested on over 1,500 real-world APIs from Google, Microsoft, Facebook, Spotify, etc.
  • Supports circular references, nested references, back-references, and cross-references
  • Maintains object reference equality — $ref pointers to the same value always resolve to the same object instance

Related Projects

Example

SwaggerParser.validate(myAPI, (err, api) => {
  if (err) {
    console.error(err);
  }
  else {
    console.log("API name: %s, Version: %s", api.info.title, api.info.version);
  }
});

Or use async/await or Promise syntax instead. The following example is the same as above:

try {
  let api = await SwaggerParser.validate(myAPI);
  console.log("API name: %s, Version: %s", api.info.title, api.info.version);
}
catch(err) {
  console.error(err);
}

For more detailed examples, please see the API Documentation

Installation

Install using npm:

npm install @apidevtools/swagger-parser

Usage

When using Swagger Parser in Node.js apps, you'll probably want to use CommonJS syntax:

const 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:

import * as SwaggerParser from '@apidevtools/swagger-parser';

Browser support

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.

API Documentation

Full API documentation is available right here

Contributing

I welcome any contributions, enhancements, and bug-fixes. Open an issue on GitHub and submit a pull request.

Building/Testing

To build/test the project locally on your computer:

  1. Clone this repo
    git clone https://github.com/APIDevTools/swagger-parser.git

  2. Install dependencies
    npm install

  3. Run the build script
    npm run build

  4. Run the tests
    npm test

  5. Check the code coverage
    npm run coverage

License

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 youll be creating employment for local families and restoring wildlife habitats.

Big Thanks To

Thanks to these awesome companies for their support of Open Source developers

GitHub NPM Coveralls

Popular Openapi Projects
Popular Swagger Projects
Popular Application Programming Interfaces Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Validator
Validation
Rest Api
Swagger
Openapi
Openapi3
Resolver
Json Schema
Universal Javascript