A node module to generate Open API 3 spec, that is importable to Redoc, Swagger, Postman and other API tools.
Loaded with an example to demonstrate
Aiming to plug & play in your current express project easily
# use npm
npm install joi-api-doc --save
Visit example/ folder to see the full example.
Creates a new SwaggerAPI instance.
Add a joi-router object to the API. The object should already have all its properties as below example
{
routes: [
{
path: '/endpoint',
method: ['post'],
meta: {
swagger: {
summary: 'New API',
description: 'New API',
tags: ['User']
}
},
request: {
body: JoiSchema
},
response: {
'200': {
body: JoiSchema
}
}
},
// More routes
];
}
Options:
- prefix: Prefix to add to Swagger path (use prefix from JoiRouter if not set)
Create a Swagger specification for this API. A base specification should be
provided with an info
object (containing at least the title
and version
strings) and any other global descriptions.
Options:
- defaultResponses: Custom default responses
{ 200: { description: 'Success' } }