mockup API device
This commit is contained in:
+18
-4
@@ -1,6 +1,7 @@
|
||||
import { openapi } from '@elysiajs/openapi'
|
||||
import { OpenAPIV3 } from 'openapi-types'
|
||||
import { PORT } from '~/config'
|
||||
import * as z from 'zod'
|
||||
|
||||
interface OpenApiDocWithTagGroups { 'x-tagGroups': { name: string, tags: string[] } }
|
||||
type OpenApiDocumentation = Omit<Partial<OpenAPIV3.Document<OpenApiDocWithTagGroups>>, 'x-express-openapi-additional-middleware' | 'x-express-openapi-validation-strict'>
|
||||
@@ -8,14 +9,16 @@ type OpenApiDocumentation = Omit<Partial<OpenAPIV3.Document<OpenApiDocWithTagGro
|
||||
export const swaggerPlugin = openapi({
|
||||
path: '/swagger',
|
||||
provider: 'scalar',
|
||||
mapJsonSchema: {
|
||||
zod: z.toJSONSchema,
|
||||
},
|
||||
documentation: {
|
||||
'info': {
|
||||
title: 'Backend node Skyrain API Documentation',
|
||||
version: 'v1.0.0',
|
||||
},
|
||||
'tags': [
|
||||
{ name: 'Authentication', description: 'Authentication API' },
|
||||
{ name: 'Users', description: 'User API' },
|
||||
{ name: 'Device', description: 'Device API' },
|
||||
],
|
||||
'servers': [
|
||||
{
|
||||
@@ -33,7 +36,7 @@ export const swaggerPlugin = openapi({
|
||||
],
|
||||
// --- Grouping di atas tag ---
|
||||
'x-tagGroups': [
|
||||
{ name: 'Auth & IAM', tags: ['Authentication', 'Users'] },
|
||||
{ name: 'Device', tags: ['Device'] },
|
||||
],
|
||||
'components': {
|
||||
securitySchemes: {
|
||||
@@ -46,8 +49,19 @@ export const swaggerPlugin = openapi({
|
||||
scheme: 'bearer',
|
||||
bearerFormat: 'JWT',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
name: 'X-API-Key',
|
||||
description: 'API key for authentication',
|
||||
},
|
||||
timestamp: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
name: 'X-Timestamp',
|
||||
description: 'UTC timestamp in ISO8601 format',
|
||||
},
|
||||
},
|
||||
},
|
||||
'security': [{ bearerAuth: [] }],
|
||||
} as OpenApiDocumentation,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user