Skip to content

Commit

Permalink
#2 added README file
Browse files Browse the repository at this point in the history
  • Loading branch information
Raisel Melian committed Jan 24, 2019
1 parent c123c10 commit 4ca3298
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 4 deletions.
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<h1 align="center">AsyncAPI linter</h1>
<p align="center">
<em>Validate your AsyncAPI specifications</em>
</p>
<br><br>

## Install

```bash
npm install -g asyncapi-linter
```

## Usage

```bash
Usage: asyncapi-linter <command>

Options:

-V, --version output the version number
-h, --help output usage information

Commands:
validate <file-or-url> validate AsyncAPI file/url. If valid, exit code is 0, otherwise exit code is 1
convert <file-or-url> convert AsyncAPI file/url from YAML to JSON and vice-versa. No compression is performed
```

### Validate Command
```bash
Usage: asyncapi-linter validate
```

#### Examples

validate a yaml specification
```bash
asyncapi-linter validate asyncapi.yaml
```

validate a json specification
```bash
asyncapi-linter validate asyncapi.json
```

### Convert Command
```bash
Usage: asyncapi-linter convert

Options:

-f, --format specify desired target format: json|yaml
-h, --help output usage information

```

#### Examples

convert to yaml
```bash
asyncapi-linter convert -f json asyncapi.json
```

convert to json
```bash
asyncapi-linter convert -f yaml asyncapi.json
```


## Requirements

* Node.js v7.6+

## Author

Raisel Melian ([@raiselmelian](http://twitter.com/raiselmelian))
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program

program
.command('validate <file-or-url>')
.description('validate AsyncAPI file/url. If valid, exit code is 0, otherwise exit code is 1.')
.description('validate AsyncAPI file/url. If valid, exit code is 0, otherwise exit code is 1')
.action(validate.command);

program
Expand Down
2 changes: 1 addition & 1 deletion test/samples/asyncapi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
asyncapid: '1.2.0'
asyncapi: '1.2.0'
info:
title: Streetlights API
version: '1.0.0'
Expand Down
4 changes: 2 additions & 2 deletions validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const command = async (specFile, cmd) => {
console.log("Valid AsyncAPI document");
process.exit(0);
}catch (e) {
console.log("Non valid AsyncAPI document");
console.error(e.message);
// console.log("Non valid AsyncAPI document");
// console.error(e.message);
process.exit(1);
}

Expand Down

0 comments on commit 4ca3298

Please sign in to comment.