Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/asyncapi/raml-dt-schema-parser
AsyncAPI schema parser for RAML data types
https://github.com/asyncapi/raml-dt-schema-parser
get-global-node-release-workflows get-global-releaserc nodejs parser raml
Last synced: 2 months ago
JSON representation
AsyncAPI schema parser for RAML data types
- Host: GitHub
- URL: https://github.com/asyncapi/raml-dt-schema-parser
- Owner: asyncapi
- License: apache-2.0
- Created: 2020-03-09T20:25:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-06T06:53:28.000Z (8 months ago)
- Last Synced: 2024-05-21T18:07:30.839Z (8 months ago)
- Topics: get-global-node-release-workflows, get-global-releaserc, nodejs, parser, raml
- Language: TypeScript
- Homepage:
- Size: 1.46 MB
- Stars: 5
- Watchers: 7
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# 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](#installation)
- [Usage](#usage)## Installation
```bash
npm install @asyncapi/raml-dt-schema-parser
// OR
yarn add @asyncapi/raml-dt-schema-parser
```## Usage
```ts
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);
``````js
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:
```js
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);
```