-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.js
More file actions
116 lines (114 loc) · 2.24 KB
/
swagger.js
File metadata and controls
116 lines (114 loc) · 2.24 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const swaggerJsdoc = require('swagger-jsdoc');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Task Manager API',
version: '1.0.0',
description: 'A Task Manager API built using Node.js, Express, and MongoDB',
},
servers: [
{
url: 'http://localhost:8008',
description: 'Local development server',
},
{
url: 'https://task-manager-api-puce.vercel.app/',
description: 'Production server',
}
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
},
schemas: {
Task: {
type: 'object',
properties: {
id: {
type: 'string',
readOnly: true,
},
title: {
type: 'string',
},
description: {
type: 'string',
},
dueDate: {
type: 'string',
format: 'date-time',
},
status: {
type: 'string',
enum: ['Not Started', 'In Progress', 'Completed'],
},
priority: {
type: 'string',
enum: ['Low', 'Medium', 'High'],
},
assignedTo: {
type: 'string',
description: 'The ID of the user to whom the task is assigned',
},
createdBy: {
type: 'string',
readOnly: true,
},
attachment: {
type: 'string',
format: 'binary',
}
},
},
User: {
type: 'object',
properties: {
id: {
type: 'string',
readOnly: true,
},
username: {
type: 'string',
},
email: {
type: 'string',
format: 'email',
},
password: {
type: 'string',
format: 'password',
},
},
},
Error: {
type: 'object',
properties: {
status: {
type: 'string',
description: 'Status of the error',
example: 'error',
},
statusCode: {
type: 'integer',
description: 'HTTP status code',
example: 500,
},
message: {
type: 'string',
description: 'Description of the error',
example: 'An error occurred while processing your request.',
},
},
},
},
},
},
apis: ['./routes/*.js'],
};
const specs = swaggerJsdoc(options);
module.exports = specs;