1.5.1 • Published 5 years ago
json-docs-generator v1.5.1
json-docs-generator
Util for describe REST APIs via docs.
Install
$ npm i json-docs-generator -D # local dev
$ npm i json-docs-generator -g # global
Usage
$ generate-docs --input ./api.js --output ./docs.md
api.js:
module.exports = {
path: './example.md',
title: 'Simple doc',
description: 'Manage users via API',
baseUrl: 'http://localhost:8080/api/v2',
tags: {
users: {
title: 'Users',
},
},
endpoints: {
'/users': {
get: {
title: 'Get users',
tags: ['users'],
headers: [
'Authorization: ***',
],
response: {
first_name: 'string',
last_name: 'string',
},
errors: {
401: 'Unauthorized',
404: 'Not found',
429: 'Too many requests',
},
},
post: {
title: 'Create user',
tags: ['users'],
body: {
first_name: {
type: 'string',
description: 'User\'s firstname',
required: true,
},
last_name: {
type: 'string',
description: 'User\'s lastname',
required: true,
},
photo: {
type: 'string',
required: false,
},
},
response: {
ok: true,
},
errors: {
400: 'Invalid data',
429: 'Too many requests',
},
},
},
},
}
The output you can see here.
License
MIT.
1.5.1
5 years ago
1.5.0
5 years ago
1.4.0
5 years ago
1.3.8
5 years ago
1.3.7
5 years ago
1.3.6
5 years ago
1.3.5
5 years ago
1.3.4
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.1
6 years ago
1.0.0
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago