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

@asyncapi/raml-dt-schema-parser

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asyncapi/raml-dt-schema-parser

An AsyncAPI schema parser for RAML data types.

  • 4.0.24
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
66K
decreased by-0.88%
Maintainers
3
Weekly downloads
 
Created
Source

RAML Data Types Schema Parser

A schema parser for RAML data types.

Note Version >= 3.0.0 of package is only supported by @asyncapi/parser version >= 2.0.0.

Warning This package is not browser-compatible.

  • Installation
  • Usage

Installation

npm install @asyncapi/raml-dt-schema-parser
// OR
yarn add @asyncapi/raml-dt-schema-parser

Usage

import { Parser } from '@asyncapi/parser';
import { RamlDTSchemaParser } from '@asyncapi/raml-dt-schema-parser';

const parser = new Parser();
parser.registerSchemaParser(RamlDTSchemaParser()); 

const asyncapiWithRAML = `
asyncapi: 2.0.0
info:
  title: Example with RAML
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/raml+yaml;version=1.0'
        payload: # The following is a RAML data type
          type: object
          properties:
            title: string
            author:
              type: string
              examples:
                anExample: Jack Johnson
`;

const { document } = await parser.parse(asyncapiWithRAML);
const { Parser } = require('@asyncapi/parser');
const { RamlDTSchemaParser } = require('@asyncapi/raml-dt-schema-parser');

const parser = new Parser();
parser.registerSchemaParser(RamlDTSchemaParser()); 

const asyncapiWithRAML = `
asyncapi: 2.0.0
info:
  title: Example with RAML
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/raml+yaml;version=1.0'
        payload: # The following is a RAML data type
          type: object
          properties:
            title: string
            author:
              type: string
              examples:
                anExample: Jack Johnson
`;

const { document } = await parser.parse(asyncapiWithRAML);

It also supports referencing remote RAML data types:

import { Parser } from '@asyncapi/parser';
import { RamlDTSchemaParser } from '@asyncapi/raml-dt-schema-parser';

const parser = new Parser();
parser.registerSchemaParser(RamlDTSchemaParser()); 

const asyncapiWithRAML = `
asyncapi: 2.0.0
info:
  title: Example with RAML
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/raml+yaml;version=1.0'
        payload:
          $ref: 'yourserver.com/data-types/library.raml#/Book'
`;

const { document } = await parser.parse(asyncapiWithRAML);

Keywords

FAQs

Package last updated on 12 Jun 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