|
@@ -26,14 +26,24 @@ const createApi = (app:OpenAPIHono) => {
|
|
|
app.route('/api/v1', authOpenApiApp)
|
|
app.route('/api/v1', authOpenApiApp)
|
|
|
|
|
|
|
|
// OpenAPI documentation endpoint
|
|
// OpenAPI documentation endpoint
|
|
|
- app.doc('/doc', {
|
|
|
|
|
|
|
+ app.doc31('/doc', {
|
|
|
openapi: '3.1.0',
|
|
openapi: '3.1.0',
|
|
|
info: {
|
|
info: {
|
|
|
title: 'API Documentation',
|
|
title: 'API Documentation',
|
|
|
version: '1.0.0'
|
|
version: '1.0.0'
|
|
|
},
|
|
},
|
|
|
|
|
+ security: [{
|
|
|
|
|
+ bearerAuth: []
|
|
|
|
|
+ }]
|
|
|
// servers: [{ url: '/api/v1' }]
|
|
// servers: [{ url: '/api/v1' }]
|
|
|
})
|
|
})
|
|
|
|
|
+ // 注册Bearer认证方案
|
|
|
|
|
+ app.openAPIRegistry.registerComponent('securitySchemes','bearerAuth',{
|
|
|
|
|
+ type:'http',
|
|
|
|
|
+ scheme:'bearer',
|
|
|
|
|
+ bearerFormat:'JWT',
|
|
|
|
|
+ description:'使用JWT进行认证'
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
return app;
|
|
return app;
|
|
|
|
|
|