-
-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathswagger.js
54 lines (50 loc) · 1.44 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
const swaggerJSDoc = require('swagger-jsdoc');
const swaggerDefinition = {
openapi: '3.0.0',
info: {
title: 'Paperless-AI API Documentation',
version: '1.0.0',
description: 'API documentation for the Paperless-AI application',
license: {
name: 'MIT',
url: 'https://opensource.org/licenses/MIT',
},
contact: {
name: 'Clusterzx',
url: 'https://github.com/Clusterzx',
},
},
servers: [
{
url: 'http://localhost:3000',
description: 'Development server',
},
// Add production server details if applicable
],
components: {
securitySchemes: {
BearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
description: 'JWT authentication token obtained from the /login endpoint. The token should be included in the Authorization header as "Bearer {token}".'
},
ApiKeyAuth: {
type: 'apiKey',
in: 'header',
name: 'x-api-key',
description: 'API key for programmatic access. This key can be generated or regenerated using the /api/key-regenerate endpoint. Include the key in the x-api-key header for authentication.'
},
},
},
security: [
{ BearerAuth: [] },
{ ApiKeyAuth: [] }
]
};
const options = {
swaggerDefinition,
apis: ['./server.js', './routes/*.js', './schemas.js'], // Path to the API docs
};
const swaggerSpec = swaggerJSDoc(options);
module.exports = swaggerSpec;