Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fastcodejava/schematodoc
This library is used to generate document from a schema
https://github.com/fastcodejava/schematodoc
json schema yaml
Last synced: 2 months ago
JSON representation
This library is used to generate document from a schema
- Host: GitHub
- URL: https://github.com/fastcodejava/schematodoc
- Owner: fastcodejava
- Created: 2016-10-01T19:51:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-24T04:07:34.000Z (about 8 years ago)
- Last Synced: 2024-04-26T00:08:51.457Z (10 months ago)
- Topics: json, schema, yaml
- Language: JavaScript
- Homepage:
- Size: 52.7 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# schematodoc Document
This library is used to generate document from a schema.
The schema can be in a json file or in a yaml file.
When a json schema is used, we get the documentation for the root key.
When a yaml file is used, we get the documentation for a particular URL and it method.## Use with Node
$ npm install schematodoc
# UsageThe module need to be executed from another js file. This module generates the documentation in a particular format.
One can use that to get the document in the desired format.To execute:
Please do install using `npm install schematodoc` and create a file `test.js` in the app root as shown below.
```js
var gen = require('schematodoc');
var inputFile = './api/swagger/swagger.yaml'; //path to yaml filevar url = 'my_url';
var method = 'post';
gen.generateDocFromSwagger(inputFile, url, method, {save: true, outputFile: inputFile});
```The generated documentation will be written in the given file.
One can customize the output according to one's needs. You have to create a function similar to the one : https://github.com/fastcodejava/schematodoc/blob/master/lib/generateOutput.js
and supply the function as shown below :```js
gen.generateDocFromSwagger(inputFile, url, method, {save: true, outputFile: inputFile}, mygenFunc);
``````js
var gen = require('schematodoc');
var inputFile = './api/swagger/swagger.yaml'; //path to yaml filevar url = 'my_url';
var method = 'post';
gen.generateDocFromSwagger(inputFile, url, method, {save: false});
```
The generated documentation will be written in the console.