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

@readme/openapi-parser

Package Overview
Dependencies
Maintainers
9
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@readme/openapi-parser

Swagger 2.0 and OpenAPI 3.x parser and validator for Node and browsers

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
217K
decreased by-18.22%
Maintainers
9
Weekly downloads
 
Created

What is @readme/openapi-parser?

@readme/openapi-parser is an npm package designed to parse, validate, and dereference OpenAPI (formerly known as Swagger) definitions. It helps developers work with OpenAPI specifications by providing tools to ensure the correctness and completeness of API definitions.

What are @readme/openapi-parser's main functionalities?

Parsing OpenAPI Definitions

This feature allows you to parse an OpenAPI definition from a file. The parsed object can then be used for further processing or validation.

const OpenAPIParser = require('@readme/openapi-parser');

async function parseOpenAPIDefinition(filePath) {
  const api = await OpenAPIParser.parse(filePath);
  console.log(api);
}

parseOpenAPIDefinition('path/to/openapi.yaml');

Validating OpenAPI Definitions

This feature allows you to validate an OpenAPI definition. It checks for errors and inconsistencies in the API definition and throws an error if any issues are found.

const OpenAPIParser = require('@readme/openapi-parser');

async function validateOpenAPIDefinition(filePath) {
  try {
    const api = await OpenAPIParser.validate(filePath);
    console.log('API definition is valid:', api);
  } catch (err) {
    console.error('API definition is invalid:', err);
  }
}

validateOpenAPIDefinition('path/to/openapi.yaml');

Dereferencing OpenAPI Definitions

This feature allows you to dereference an OpenAPI definition. It resolves all $ref pointers in the API definition, replacing them with the actual referenced objects.

const OpenAPIParser = require('@readme/openapi-parser');

async function dereferenceOpenAPIDefinition(filePath) {
  const api = await OpenAPIParser.dereference(filePath);
  console.log(api);
}

dereferenceOpenAPIDefinition('path/to/openapi.yaml');

Other packages similar to @readme/openapi-parser

Keywords

FAQs

Package last updated on 12 Apr 2022

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