-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.js
47 lines (44 loc) · 1.22 KB
/
swagger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const swaggerAutogen = require('swagger-autogen')({openapi: '3.0.0'});
// Schemas
const registerPayload = require("./authorization/schemas/registerPayload");
const loginPayload = require("./authorization/schemas/loginPayload");
const createSeatPayload = require("./seats/schemas/createSeatPayload");
const createStopPayload = require("./stops/schemas/createStopPayload");
const createTicketPayload = require("./tickets/schemas/createTicketPayload");
const doc = {
info: {
version: '1.0.0',
title: 'Booking APIs',
description: 'APIs to support bus tickets booking'
},
servers: [
{
url: 'http://127.0.0.1:3000',
description: 'localhost'
},
],
tags: [
{
name: 'runtime',
description: 'nodejs'
}
],
components: {
securitySchemes:{
bearerAuth: {
type: 'http',
scheme: 'bearer'
}
},
'@schemas': {
registerPayload: registerPayload,
loginPayload: loginPayload,
createSeatPayload : createSeatPayload,
createStopPayload: createStopPayload,
createTicketPayload: createTicketPayload,
}
}
};
const outputFile = './swagger-output.json';
const routes = ['./app.js'];
swaggerAutogen(outputFile, routes, doc);