Skip to content

Commit

Permalink
chore: Bump to release candidate and readme improvement (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Aug 14, 2020
1 parent b45bd3c commit c83b8ef
Show file tree
Hide file tree
Showing 8 changed files with 597 additions and 58 deletions.
99 changes: 99 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"projectName": "@asyncapi/parser",
"projectOwner": "asyncapi",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"commitConvention": "none",
"contributors": [
{
"login": "fmvilas",
"name": "Fran Méndez",
"avatar_url": "https://avatars3.githubusercontent.com/u/242119?v=4",
"profile": "http://www.fmvilas.com/",
"contributions": [
"question",
"bug",
"code",
"doc",
"ideas",
"maintenance",
"plugin",
"review",
"test"
]
},
{
"login": "derberg",
"name": "Lukasz Gornicki",
"avatar_url": "https://avatars1.githubusercontent.com/u/6995927?v=4",
"profile": "https://resume.github.io/?derberg",
"contributions": [
"question",
"bug",
"code",
"doc",
"ideas",
"maintenance",
"review",
"test"
]
},
{
"login": "jonaslagoni",
"name": "Jonas Lagoni",
"avatar_url": "https://avatars1.githubusercontent.com/u/13396189?v=4",
"profile": "https://github.com/jonaslagoni",
"contributions": [
"question",
"bug",
"code",
"ideas",
"review"
]
},
{
"login": "magicmatatjahu",
"name": "Maciej Urbańczyk",
"avatar_url": "https://avatars2.githubusercontent.com/u/20404945?v=4",
"profile": "https://github.com/magicmatatjahu",
"contributions": [
"bug",
"code",
"review"
]
},
{
"login": "jcmellado",
"name": "Juan Mellado",
"avatar_url": "https://avatars2.githubusercontent.com/u/6494060?v=4",
"profile": "https://www.inmensia.com/",
"contributions": [
"code"
]
},
{
"login": "jamescrowley",
"name": "James Crowley",
"avatar_url": "https://avatars1.githubusercontent.com/u/509533?v=4",
"profile": "https://www.jamescrowley.net/",
"contributions": [
"code"
]
},
{
"login": "rmelian",
"name": "raisel melian",
"avatar_url": "https://avatars3.githubusercontent.com/u/4565267?v=4",
"profile": "https://github.com/rmelian",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 4
}
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
run: npm test
- name: Regenerate docs
run: npm run docs
- name: Generate README ToC
run: npm run gen-readme-toc
- name: Regenerate types
run: npm run types
- name: Generate bundle.js for the browser
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/update-docs-on-docs-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Update generated parts of documentation on docs: commits'

on:
push:
branches:
- master

jobs:
docs-gen:
name: 'Generate docs and create PR'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 13
- name: Install dependencies
run: npm ci
- name: Regenerate docs
run: npm run docs
- name: Generate README ToC
run: npm run gen-readme-toc
- name: Create Pull Request with updated docs
# PR should be created within this GH action only if it is a docs: commit
# Otherwise it will conflict with release workflow
if: startsWith(github.event.commits[0].message, 'docs:')
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: 'chore: update generated docs'
committer: asyncapi-bot <[email protected]>
author: asyncapi-bot <[email protected]>
title: 'chore: update generated docs'
body: 'Update of docs that are generated and were forgotten on PR level.'
branch: gen-docs-update
10 changes: 10 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test/
.DS_Store
*.swp
.github
.all-contributorsrc
.editorconfig
coverage
.nyc_output
assets/logo.png
vscode
29 changes: 0 additions & 29 deletions CONTRIBUTING.md

This file was deleted.

96 changes: 71 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,46 @@
<br>
<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>
JS Parser
JavaScript Parser
</h5>
<h4 align="center">Parse and validate AsyncAPI documents</h4>
<p align="center">
<em>Use this package to parse and validate AsyncAPI documents —either YAML or JSON— in your Node.js or browser application. Updated bundle for the browser is always attached to the GitHub Release.</em>
</p>

---
![npm](https://img.shields.io/npm/v/@asyncapi/parser?style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@asyncapi/parser?style=for-the-badge)

## :loudspeaker: ATTENTION:
> :warning: This package doesn't support AsyncAPI 1.x anymore. We recommend to upgrade to the latest AsyncAPI version using the [AsyncAPI converter](https://github.com/asyncapi/converter-js). If you need to convert documents on the fly, you may use the [Node.js](https://github.com/asyncapi/converter-js) or [Go](https://github.com/asyncapi/converter-go) converters.
This package is under development and it has not reached version 1.0.0 yet, what means its API might change without prior notice. Once it reaches its first stable version, we'll follow semantic versioning.
<!-- toc is generated with GitHub Actions do not remove toc markers -->

---
<!-- toc -->

Use this package to parse and validate AsyncAPI documents —either YAML or JSON— in your Node.js or browser application. Updated bundle for the browser is always attached to the GitHub Release.
- [Install](#install)
- [Examples](#examples)
* [Example passing inline AsyncAPI](#example-passing-inline-asyncapi)
* [Example passing a URL](#example-passing-a-url)
* [Example using Avro schemas](#example-using-avro-schemas)
* [Example using OpenAPI schemas](#example-using-openapi-schemas)
* [Example using RAML data types](#example-using-raml-data-types)
- [API documentation](#api-documentation)
- [Custom message parsers](#custom-message-parsers)
- [Error types](#error-types)
- [Circular references](#circular-references)
- [Develop](#develop)
- [Contributing](#contributing)
- [Contributors](#contributors)

> This package doesn't support AsyncAPI 1.x.
<!-- tocstop -->

### Install
## Install

```
npm install @asyncapi/parser
```

### API
## Examples

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

### Examples

##### Example passing inline AsyncAPI
### Example passing inline AsyncAPI

```js
const parser = require('@asyncapi/parser');
Expand Down Expand Up @@ -60,7 +71,7 @@ console.log(doc.info().title());
// => Example
```

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

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

##### Example using OpenAPI schemas
### Example using Avro schemas

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

### 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
### 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.

### Custom message parsers
## API documentation

See [API documentation](/API.md) for more example and full API reference information.

## Custom message parsers

AsyncAPI doesn't enforce one schema format for messages. You can have payload of your messages described with OpenAPI, Avro, etc. This parser by default parses only AsyncAPI schema format. You can extend it by creating a custom parser and registering it withing the parser:

Expand All @@ -103,13 +122,13 @@ AsyncAPI doesn't enforce one schema format for messages. You can have payload of
}
```
2. Before parsing an AsyncAPI document with a parser, register the additional custom schema parser:
```
```js
const myCustomParser = require('mycustomParser');
parser.registerSchemaParser(myCustomParser);
```

### Error types
## Error types

This package throws a bunch of different error types. All errors contain a `type` (prefixed by this repo URL) and a `title` field. The following table describes all the errors and the extra fields they include:

Expand All @@ -130,21 +149,48 @@ This package throws a bunch of different error types. All errors contain a `type
For more information about the `ParserError` class, [check out the documentation](./API.md#new_ParserError_new).
### Circular references
## Circular references
Parser dereferences all circular references by default. In addition, to simplify interactions with the parser, the following is added:
- `x-parser-circular` property is added to the root of the AsyncAPI document to indicate that the document contains circular references. Tooling developer that doesn't want to support circular references can use the `hasCircular()` function to check the document and provide a proper message to the user.
- `x-parser-circular` property is added to every schema of array type that is circular. To check if schema is circular or not, you should use `isCircular()` function on a Schema model like `document.components().schema('RecursiveSelf').properties()['selfChildren'].isCircular()`.
- `x-parser-circular-props` property is added to every schema of object type with a list of properties that are circular. To check if a schema has properties with circular references, you should use `hasCircularProps()` function. To get a list of properties with circular references, you should use `circularProps()` function.

### Develop
## Develop

1. Run tests with `npm test`
1. Write code and tests.
1. Make sure all tests pass `npm test`
1. Make sure code is well formatted and secure `npm run lint`

Release regenerates API documentation and browser bundle, so you do not have to regenerate it manually with `npm run docs` and `npm run prepublishOnly`.

## Contributing

Read [CONTRIBUTING](CONTRIBUTING.md) guide.
Read [CONTRIBUTING](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md) guide.

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="http://www.fmvilas.com/"><img src="https://avatars3.githubusercontent.com/u/242119?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fran Méndez</b></sub></a><br /><a href="#question-fmvilas" title="Answering Questions">💬</a> <a href="https://github.com/asyncapi/@asyncapi/parser/issues?q=author%3Afmvilas" title="Bug reports">🐛</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=fmvilas" title="Code">💻</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=fmvilas" title="Documentation">📖</a> <a href="#ideas-fmvilas" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-fmvilas" title="Maintenance">🚧</a> <a href="#plugin-fmvilas" title="Plugin/utility libraries">🔌</a> <a href="https://github.com/asyncapi/@asyncapi/parser/pulls?q=is%3Apr+reviewed-by%3Afmvilas" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=fmvilas" title="Tests">⚠️</a></td>
<td align="center"><a href="https://resume.github.io/?derberg"><img src="https://avatars1.githubusercontent.com/u/6995927?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lukasz Gornicki</b></sub></a><br /><a href="#question-derberg" title="Answering Questions">💬</a> <a href="https://github.com/asyncapi/@asyncapi/parser/issues?q=author%3Aderberg" title="Bug reports">🐛</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=derberg" title="Code">💻</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=derberg" title="Documentation">📖</a> <a href="#ideas-derberg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-derberg" title="Maintenance">🚧</a> <a href="https://github.com/asyncapi/@asyncapi/parser/pulls?q=is%3Apr+reviewed-by%3Aderberg" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=derberg" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/jonaslagoni"><img src="https://avatars1.githubusercontent.com/u/13396189?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jonas Lagoni</b></sub></a><br /><a href="#question-jonaslagoni" title="Answering Questions">💬</a> <a href="https://github.com/asyncapi/@asyncapi/parser/issues?q=author%3Ajonaslagoni" title="Bug reports">🐛</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=jonaslagoni" title="Code">💻</a> <a href="#ideas-jonaslagoni" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/asyncapi/@asyncapi/parser/pulls?q=is%3Apr+reviewed-by%3Ajonaslagoni" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/magicmatatjahu"><img src="https://avatars2.githubusercontent.com/u/20404945?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maciej Urbańczyk</b></sub></a><br /><a href="https://github.com/asyncapi/@asyncapi/parser/issues?q=author%3Amagicmatatjahu" title="Bug reports">🐛</a> <a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=magicmatatjahu" title="Code">💻</a> <a href="https://github.com/asyncapi/@asyncapi/parser/pulls?q=is%3Apr+reviewed-by%3Amagicmatatjahu" title="Reviewed Pull Requests">👀</a></td>
</tr>
<tr>
<td align="center"><a href="https://www.inmensia.com/"><img src="https://avatars2.githubusercontent.com/u/6494060?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Juan Mellado</b></sub></a><br /><a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=jcmellado" title="Code">💻</a></td>
<td align="center"><a href="https://www.jamescrowley.net/"><img src="https://avatars1.githubusercontent.com/u/509533?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Crowley</b></sub></a><br /><a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=jamescrowley" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/rmelian"><img src="https://avatars3.githubusercontent.com/u/4565267?v=4?s=100" width="100px;" alt=""/><br /><sub><b>raisel melian</b></sub></a><br /><a href="https://github.com/asyncapi/@asyncapi/parser/commits?author=rmelian" title="Code">💻</a></td>
</tr>
</table>

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Loading

0 comments on commit c83b8ef

Please sign in to comment.