-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.js
62 lines (59 loc) · 1.93 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' });
const doc = {
info: {
version: "1.0.0",
title: "FullStackDelas - Backend",
description: "API Backend do projeto FullStackDelas"
},
servers: [
{
url: 'http://fullstackdelas-back.onrender.com/'
}
],
components: {
schemas: {
requestRegisterCreate: {
$nome: "Nome do Usuário",
$email: "email@test.com",
$linkedin: "https://www.linkedin.com/in/usuario",
$frase: "Uma frase bonita"
},
responseGet: [
{
"nome": "Nome do Usuário",
"email": "email@test.com",
"linkedin": "https://www.linkedin.com/in/usuario",
"frase": "Uma frase bonita"
}
],
responseGetRegisterById: {
$nome: "Nome do Usuário",
$email: "email@test.com",
$linkedin: "https://www.linkedin.com/in/usuario",
$frase: "Uma frase bonita"
},
responseCreateSuccess: {
$msg: "Registro criado com sucesso",
$key: "-123abc"
},
responseUpdateSuccess: {
$msg: "Registro atualizado com sucesso",
$key: "-123abc"
},
responseDeleteSuccess: {
$msg: "Registro excluído com sucesso"
},
responseError: {
$error: "Erro interno do servidor"
},
responseNotFound: {
$error: "Registro não encontrado"
}
}
}
};
const outputFile = './swagger-output.json';
const endpointsFiles = ['./routes/linkedin.js'];
swaggerAutogen(outputFile, endpointsFiles, doc).then(() => {
require('./index'); // Your project's root file
});