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

Create native js parser #7

Merged
merged 17 commits into from
Aug 5, 2019
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
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
os:
- windows
- linux
- osx

language: node_js
node_js:
- "10"
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<h5 align="center">
<br>
<a href="https://asyncapi.org"><img src="https://github.com/asyncapi/parser-nodejs/raw/master/assets/logo.png" alt="AsyncAPI logo" width="200"></a>
<a href="https://www.asyncapi.org"><img src="https://github.com/asyncapi/parser-nodejs/raw/master/assets/logo.png" alt="AsyncAPI logo" width="200"></a>
<br>
Node.js parser
JS Parser
</h5>
<h4 align="center">Parse and validation AsyncAPI documents</h4>
<h4 align="center">Parse and validate AsyncAPI documents</h4>

---

Use this package to parse and validate AsyncAPI documents —either YAML or JSON— in your Node.js application.
## :loudspeaker: ATTENTION:

This package is under development and it has not reached version 1.0.0, what means that its API might change without prior notice. Once it reaches its first stable version, we'll follow semantic versioning.

---

Use this package to parse and validate AsyncAPI documents —either YAML or JSON— in your Node.js or browser application.

> This package doesn't support AsyncAPI 1.x.

Expand All @@ -20,18 +26,21 @@ npm install asyncapi-parser

### API

#### `.parse(yamlOrJSONdocument) => AsyncAPIDocument`
#### `.parse(yamlOrJSONdocument, options) => JSONDocument`

The `parse` method will take care of parsing and validating the AsyncAPI document. It returns an AsyncAPIDocument, which is a JSON version of the document with all the message payloads converted to JSON Schema Draft 7 schemas and the traits already resolved and merged into the document.

#### `.parseUrl(url, options) => JSONDocument`

The `parseUrl` method fetches a YAML or JSON document on the given URL and passes its content to the `parse` method.

### Example

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

const doc = parser.parse(`
asyncapi: '2.0.0'
id: 'urn:com.application.example'
asyncapi: '2.0.0-rc1'
info:
title: Example
version: '0.1.0'
Expand All @@ -54,7 +63,3 @@ const doc = parser.parse(`
console.log(doc.info.title);
// => Example
```

### Implementation details

This package offers a wrapper for the compiled version of the original Go parser. [Check out the Go parser for more details](https://github.com/asyncapi/parser).
Binary file removed bin/cparser-darwin-10.6-amd64.dylib
Binary file not shown.
87 changes: 0 additions & 87 deletions bin/cparser-darwin-10.6-amd64.h

This file was deleted.

Binary file removed bin/cparser-darwin-amd64.so.dylib
Binary file not shown.
87 changes: 0 additions & 87 deletions bin/cparser-darwin-amd64.so.h

This file was deleted.

Binary file removed bin/cparser-linux-amd64.dll
Binary file not shown.
87 changes: 0 additions & 87 deletions bin/cparser-linux-amd64.h

This file was deleted.

Binary file removed bin/cparser-linux-amd64.so
Binary file not shown.
Binary file removed bin/cparser-windows-amd64.dll
Binary file not shown.
Loading