@@ -13,7 +13,7 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
13
13
dictionaries : [ 'jsdoc' ] ,
14
14
hierarchy : true ,
15
15
} ) ;
16
- const tags = [ ] ;
16
+ const tags = new Set ( ) ;
17
17
const temporaryDocument = {
18
18
'x-send-defaults' : true ,
19
19
'openapi' : '3.0.0' ,
@@ -59,25 +59,33 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
59
59
BasicAuth : [ ] ,
60
60
} ,
61
61
] ,
62
- 'tags' : tags ,
62
+ 'tags' : [ ] ,
63
63
} ;
64
64
const requiredSchema = [ 'method' , 'id' , 'jsonrpc' ] ;
65
- for ( const module of documents ) {
66
- const apiName = module . meta . filename . replace ( / . j s $ / , '' ) ;
65
+ prepare: for ( const module of documents ) {
66
+ let isJsonRpc = false ;
67
67
68
68
if ( module . tags && Array . isArray ( module . tags ) ) {
69
- for ( const tag of module . tags ) {
70
- tags . push ( ...new Set ( tag . value . split ( ',' ) . map ( t => t . trim ( ) ) ) ) ;
69
+ for ( const { title, value} of module . tags ) {
70
+ if ( title === 'json-rpc' ) {
71
+ isJsonRpc = true ;
72
+ } else if ( title === 'tags' && value ) {
73
+ value . split ( ',' ) . map ( t => t . trim ( ) ) . forEach ( t => tags . add ( t ) ) ;
74
+ }
71
75
}
72
76
}
77
+ if ( ! isJsonRpc ) {
78
+ continue prepare;
79
+ }
80
+ const apiName = module . meta . filename . replace ( / .j s $ / , '' ) ;
73
81
74
82
const schema = {
75
83
post : {
76
84
operationId : `${ module . meta . filename } ` ,
77
85
deprecated : module . deprecated || false ,
78
86
summary : `/${ apiName } ` ,
79
87
description : module . description ,
80
- tags : tags ,
88
+ tags : Array . from ( tags ) ,
81
89
parameters : [ ] ,
82
90
responses : {
83
91
'200' : {
0 commit comments