Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract RAML and OpenAPI schema parsers to their own package #44

Merged
merged 4 commits into from
Mar 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ npm install asyncapi-parser

[Check out the API page](./API.md).

##### Example
### Examples

##### Example passing inline AsyncAPI

```js
const parser = require('asyncapi-parser');

const doc = await parser.parse(`
asyncapi: '2.0.0-rc1'
asyncapi: '2.0.0'
info:
title: Example
version: '0.1.0'
Expand All @@ -58,7 +60,7 @@ console.log(doc.info().title());
// => Example
```

##### Example
##### Example passing a URL

```js
const parser = require('asyncapi-parser');
Expand All @@ -69,6 +71,14 @@ console.log(doc.info().title());
// => Example
```

##### Example using OpenAPI schemas

Head over to [asyncapi/openapi-schema-parser](https://www.github.com/asyncapi/openapi-schema-parser) for more information.

##### Example using RAML data types

Head over to [asyncapi/raml-dt-schema-parser](https://www.github.com/asyncapi/raml-dt-schema-parser) for more information.

### Develop

1. Run tests with `npm test`
Expand Down
12 changes: 0 additions & 12 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const parser = require('./parser');
const openapiSchemaParser = require('./schema-parsers/openapi');
const ramlDtParser = require('./schema-parsers/raml-datatype');

const noop = () => {}; // No operation

Expand All @@ -13,14 +11,4 @@ parser.registerSchemaParser([
'application/schema+yaml;version=draft-07',
], noop);

parser.registerSchemaParser([
'application/vnd.oai.openapi;version=3.0.0',
'application/vnd.oai.openapi+json;version=3.0.0',
'application/vnd.oai.openapi+yaml;version=3.0.0',
], openapiSchemaParser);

parser.registerSchemaParser([
'application/raml+yaml;version=1.0',
], ramlDtParser);

fmvilas marked this conversation as resolved.
Show resolved Hide resolved
module.exports = parser;
58 changes: 0 additions & 58 deletions lib/schema-parsers/openapi.js

This file was deleted.

23 changes: 0 additions & 23 deletions lib/schema-parsers/raml-datatype.js

This file was deleted.

Loading