@@ -11,36 +11,36 @@ export const DOCS_ROUTE_PREFIX = '/docs';
11
11
export default fp ( async ( fastify ) => {
12
12
fastify . register ( swagger , {
13
13
hideUntagged : true ,
14
- swagger : {
14
+ openapi : {
15
+ openapi : '3.1.0' ,
15
16
info : {
16
17
title : 'Bitcoin/RGB++ Assets API' ,
17
18
version : pkg . version ,
18
19
} ,
19
- consumes : [ 'application/json' ] ,
20
- produces : [ 'application/json' ] ,
21
20
security : [ { apiKey : [ ] } ] ,
22
- securityDefinitions : {
23
- apiKey : {
24
- type : 'apiKey' ,
25
- name : 'Authorization' ,
26
- in : 'header' ,
27
- description : 'JWT token for authentication. Example: Bearer <token>' ,
21
+ components : {
22
+ securitySchemes : {
23
+ apiKey : {
24
+ type : 'apiKey' ,
25
+ name : 'Authorization' ,
26
+ in : 'header' ,
27
+ description : 'JWT token for authentication. Example: Bearer <token>' ,
28
+ } ,
28
29
} ,
29
30
} ,
30
31
} ,
31
32
transform : jsonSchemaTransform ,
32
- transformObject : ( { swaggerObject } ) => {
33
+ transformObject : ( { openapiObject } ) => {
33
34
if ( env . NODE_ENV === 'production' ) {
34
- const { paths = { } } = swaggerObject ;
35
- const newPaths = Object . entries ( paths ) . reduce ( ( acc , [ path , methods ] ) => {
35
+ const { paths = { } } = openapiObject ;
36
+ openapiObject . paths = Object . entries ( paths ) . reduce ( ( acc , [ path , methods ] ) => {
36
37
if ( SWAGGER_PROD_IGNORE_URLS . some ( ( ignorePath ) => path . startsWith ( ignorePath ) ) ) {
37
38
return acc ;
38
39
}
39
40
return { ...acc , [ path ] : methods } ;
40
41
} , { } ) ;
41
- swaggerObject . paths = newPaths ;
42
42
}
43
- return swaggerObject ;
43
+ return openapiObject ;
44
44
} ,
45
45
} ) ;
46
46
fastify . register ( swaggerUI , {
0 commit comments