-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathopenapi.ts
More file actions
33 lines (30 loc) · 900 Bytes
/
openapi.ts
File metadata and controls
33 lines (30 loc) · 900 Bytes
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 swagger from '@fastify/swagger'
import type { FastifyPluginAsync } from 'fastify'
import fp from 'fastify-plugin'
const openapi: FastifyPluginAsync = async fastify => {
// Register Swagger plugin to generate OpenAPI spec
await fastify.register(swagger, {
openapi: {
info: {
title: 'Basilic API',
version: '1.0.0',
description: 'Basilic API documentation',
},
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
},
},
},
security: [{ bearerAuth: [] }],
},
})
// Note: Scalar UI is now served via custom route at /reference
// The Scalar plugin is not registered here to allow custom HTML wrapper with login
// OpenAPI JSON is served at /reference/openapi.json via custom route
}
export default fp(openapi, {
name: 'openapi',
})