Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apidevtools/swagger-parser

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apidevtools/swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser and validator for Node and browsers

  • 9.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @apidevtools/swagger-parser?

The @apidevtools/swagger-parser npm package is a tool that allows you to parse, validate, and dereference Swagger files (now known as OpenAPI Specifications). It supports Swagger 2.0 and OpenAPI 3.0, providing a way to ensure that API documentation is correct and adheres to the specification standards.

What are @apidevtools/swagger-parser's main functionalities?

Parse and Validate

This feature allows you to parse and validate a Swagger/OpenAPI file, ensuring it is correct and follows the specification.

const SwaggerParser = require('@apidevtools/swagger-parser');

SwaggerParser.validate('path/to/swagger.yaml')
  .then(api => {
    console.log('API name: %s, Version: %s', api.info.title, api.info.version);
  })
  .catch(err => {
    console.error(err);
  });

Dereference

Dereferencing resolves all $ref pointers in the Swagger/OpenAPI document, replacing them with their referenced objects or values.

const SwaggerParser = require('@apidevtools/swagger-parser');

SwaggerParser.dereference('path/to/swagger.yaml')
  .then(api => {
    console.log('Dereferenced API:', api);
  })
  .catch(err => {
    console.error(err);
  });

Bundle

Bundling takes all the separate files that make up a Swagger/OpenAPI document and bundles them into a single file.

const SwaggerParser = require('@apidevtools/swagger-parser');

SwaggerParser.bundle('path/to/swagger.yaml')
  .then(api => {
    console.log('Bundled API:', api);
  })
  .catch(err => {
    console.error(err);
  });

Other packages similar to @apidevtools/swagger-parser

Keywords

FAQs

Package last updated on 14 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc