Socket
Socket
Sign inDemoInstall

webapi-parser

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webapi-parser

WebApi Parser


Version published
Weekly downloads
109K
increased by7.22%
Maintainers
1
Weekly downloads
 
Created

What is webapi-parser?

webapi-parser is a versatile library for parsing, validating, and transforming API definitions. It supports multiple API specification formats including RAML, OpenAPI, and AsyncAPI, making it a powerful tool for developers working with various API standards.

What are webapi-parser's main functionalities?

Parsing API Definitions

This feature allows you to parse API definitions written in RAML, OpenAPI, or AsyncAPI formats. The code sample demonstrates parsing a simple RAML 1.0 API definition.

const wap = require('webapi-parser');

async function parseApi() {
  const model = await wap.raml10.parse(`#%RAML 1.0
  title: My API
  version: v1
  baseUri: http://api.example.com/v1
  `);
  console.log(model);
}

parseApi();

Validating API Definitions

This feature allows you to validate API definitions to ensure they conform to the respective specification. The code sample demonstrates validating a RAML 1.0 API definition.

const wap = require('webapi-parser');

async function validateApi() {
  const model = await wap.raml10.parse(`#%RAML 1.0
  title: My API
  version: v1
  baseUri: http://api.example.com/v1
  `);
  const report = await wap.raml10.validate(model);
  console.log(report);
}

validateApi();

Transforming API Definitions

This feature allows you to transform API definitions from one format to another, such as from RAML to OpenAPI. The code sample demonstrates transforming a RAML 1.0 API definition to an OpenAPI 2.0 definition.

const wap = require('webapi-parser');

async function transformApi() {
  const model = await wap.raml10.parse(`#%RAML 1.0
  title: My API
  version: v1
  baseUri: http://api.example.com/v1
  `);
  const oasModel = await wap.oas20.generate(model);
  console.log(oasModel);
}

transformApi();

Other packages similar to webapi-parser

FAQs

Package last updated on 17 Sep 2019

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