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

@swagger-api/apidom-parser-adapter-openapi-yaml-3-1

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swagger-api/apidom-parser-adapter-openapi-yaml-3-1

Parser adapter for parsing YAML documents into OpenAPI 3.1.x namespace.

  • 1.0.0-alpha.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @swagger-api/apidom-parser-adapter-openapi-yaml-3-1?

@swagger-api/apidom-parser-adapter-openapi-yaml-3-1 is an npm package designed to parse OpenAPI 3.1 YAML documents. It is part of the ApiDOM ecosystem, which provides tools for working with API descriptions in various formats. This package specifically focuses on handling OpenAPI 3.1 YAML documents, allowing developers to parse, manipulate, and validate these documents within their applications.

What are @swagger-api/apidom-parser-adapter-openapi-yaml-3-1's main functionalities?

Parsing OpenAPI 3.1 YAML Documents

This feature allows you to parse an OpenAPI 3.1 YAML document into a JavaScript object. The code sample demonstrates how to use the `parse` function to convert a YAML string into a parsed object.

const { parse } = require('@swagger-api/apidom-parser-adapter-openapi-yaml-3-1');

const yamlDocument = `
openapi: 3.1.0
info:
  title: Sample API
  version: 1.0.0
paths:
  /example:
    get:
      summary: Example endpoint
      responses:
        '200':
          description: Successful response
`;

parse(yamlDocument).then((parsed) => {
  console.log(parsed);
}).catch((error) => {
  console.error('Error parsing YAML:', error);
});

Validating OpenAPI 3.1 YAML Documents

This feature allows you to validate an OpenAPI 3.1 YAML document. The code sample demonstrates how to use the `validate` function to check if a YAML string conforms to the OpenAPI 3.1 specification.

const { validate } = require('@swagger-api/apidom-parser-adapter-openapi-yaml-3-1');

const yamlDocument = `
openapi: 3.1.0
info:
  title: Sample API
  version: 1.0.0
paths:
  /example:
    get:
      summary: Example endpoint
      responses:
        '200':
          description: Successful response
`;

validate(yamlDocument).then((result) => {
  if (result.valid) {
    console.log('YAML document is valid');
  } else {
    console.error('Validation errors:', result.errors);
  }
}).catch((error) => {
  console.error('Error validating YAML:', error);
});

Other packages similar to @swagger-api/apidom-parser-adapter-openapi-yaml-3-1

FAQs

Package last updated on 21 Oct 2024

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