import { openapi } from '@elysiajs/openapi' import { OpenAPIV3 } from 'openapi-types' import * as z from 'zod' interface OpenApiDocWithTagGroups { 'x-tagGroups': { name: string, tags: string[] } } type OpenApiDocumentation = Omit>, 'x-express-openapi-additional-middleware' | 'x-express-openapi-validation-strict'> export const swaggerPlugin = openapi({ path: '/docs', provider: 'scalar', mapJsonSchema: { zod: z.toJSONSchema, }, documentation: { 'info': { title: 'Vega Cloud API', version: 'v1.0.0', }, 'tags': [ { name: 'Auth', description: 'Auth API' }, { name: 'Device', description: 'Device API' }, ], // --- Grouping di atas tag --- 'x-tagGroups': [ { name: 'Auth', tags: ['Auth'] }, { name: 'Device', tags: ['Device'] }, ], 'components': { securitySchemes: { apiKey: { type: 'apiKey', in: 'header', name: 'X-API-Key', description: 'API key for authentication', }, }, }, } as OpenApiDocumentation, exclude: { paths: ['/live', '/ready', '/'], }, })