From 4ca32985fba9423879be2fc57caf0d1386a7e57c Mon Sep 17 00:00:00 2001 From: Raisel Melian Date: Thu, 24 Jan 2019 18:33:21 -0500 Subject: [PATCH] #2 added README file --- README.md | 75 +++++++++++++++++++++++++++++++++++++++ cli.js | 2 +- test/samples/asyncapi.yml | 2 +- validate.js | 4 +-- 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..723062e --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +

AsyncAPI linter

+

+ Validate your AsyncAPI specifications +

+

+ +## Install + +```bash +npm install -g asyncapi-linter +``` + +## Usage + +```bash +Usage: asyncapi-linter + +Options: + +-V, --version output the version number +-h, --help output usage information + +Commands: +validate validate AsyncAPI file/url. If valid, exit code is 0, otherwise exit code is 1 +convert 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)) diff --git a/cli.js b/cli.js index 5b45454..8d17722 100755 --- a/cli.js +++ b/cli.js @@ -15,7 +15,7 @@ program program .command('validate ') - .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 diff --git a/test/samples/asyncapi.yml b/test/samples/asyncapi.yml index c82f09e..4fc4a98 100644 --- a/test/samples/asyncapi.yml +++ b/test/samples/asyncapi.yml @@ -1,4 +1,4 @@ -asyncapid: '1.2.0' +asyncapi: '1.2.0' info: title: Streetlights API version: '1.0.0' diff --git a/validate.js b/validate.js index 680046b..3b95ede 100644 --- a/validate.js +++ b/validate.js @@ -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); }