Skip to content

Commit 5bc8b37

Browse files
author
John Doherty
committed
updated docs
1 parent c9651c0 commit 5bc8b37

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

README.MD

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ npm install --save jsdoc-to-json-schema
1717
```js
1818
var toJsonSchema = require('jsdoc-to-json-schema');
1919

20-
// generate a JSON schema for product.js
20+
// OPTION 1: generate a JSON schema for product.js and save it to disk
2121
toJsonSchema('./example/product.js', './example/product.schema.json');
22+
23+
// OPTION 2: generate a JSON schema and return it as an object
24+
toJsonSchema('./example/product.js').then(function(schema){
25+
// do something with it
26+
});
27+
28+
// OPTION 3: generate a JSON schema, save it to disk and return it as an object
29+
toJsonSchema('./example/product.js', './example/product.schema.json').then(function(schema){
30+
// do something with it
31+
});
2232
```
2333

2434
### Using this module via the command line
@@ -41,7 +51,7 @@ var toJsonSchema = require('../lib/jsdoc-to-json-schema.js');
4151
// create an express route
4252
app.get('/', function(req, res){
4353

44-
// return JSON schema generated from person.js script comments
54+
// pipe schema directly to the response stream
4555
toJsonSchema('./examples/person.js', res);
4656
});
4757

@@ -55,7 +65,7 @@ For use with express consider the dedicated express middleware project [express-
5565

5666
### Input *(singleton)*
5767

58-
JavaScript file containing jsDoc *@schema* tags used to specify the JSON schema output.
68+
JavaScript file containing jsDoc @schema tags used to define the JSON schema:
5969

6070
```js
6171
/**
@@ -134,7 +144,7 @@ var Person = {
134144

135145
### Input *(instance)*
136146

137-
JavaScript file containing jsDoc *@schema* tags used to specify the JSON schema output.
147+
JavaScript file containing jsDoc @schema tags used to define the JSON schema:
138148

139149
```js
140150
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsdoc-to-json-schema",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "Generate JSON schemas from JavaScript code comments using a new jsDoc @schema tag.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)