-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathswagger.ts
More file actions
33 lines (31 loc) · 1.05 KB
/
swagger.ts
File metadata and controls
33 lines (31 loc) · 1.05 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
import fp from 'fastify-plugin';
import swagger from '@fastify/swagger';
import swaggerUi from '@fastify/swagger-ui';
export default fp(async (fastify) => {
await fastify.register(swagger, {
openapi: {
info: {
title: 'ShExMap Repository API',
description: 'REST API for storing, retrieving, and managing ShExMaps',
version: '1.0.0',
},
servers: [{ url: '/api/v1' }],
components: {
securitySchemes: {
bearerAuth: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
apiKey: { type: 'apiKey', in: 'header', name: 'X-API-Key' },
},
},
tags: [
{ name: 'shexmaps', description: 'ShExMap CRUD and search' },
{ name: 'coverage', description: 'Coverage metrics and gap analysis' },
{ name: 'users', description: 'User profiles and dashboards' },
{ name: 'auth', description: 'Authentication endpoints' },
],
},
});
await fastify.register(swaggerUi, {
routePrefix: '/api/v1/docs',
uiConfig: { docExpansion: 'list' },
});
});