Skip to content

Commit

Permalink
Extract RAML and OpenAPI schema parsers to their own package (#44)
Browse files Browse the repository at this point in the history
* Extract RAML parser to its own package

* Remove RAML tests

* Extract OpenAPI too

* Add RAML and OpenAPI links to README
  • Loading branch information
fmvilas authored Mar 14, 2020
1 parent fbd2596 commit ba4b33a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 423 deletions.
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);

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

0 comments on commit ba4b33a

Please sign in to comment.