@@ -13,7 +13,7 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
1313 dictionaries : [ 'jsdoc' ] ,
1414 hierarchy : true ,
1515 } ) ;
16- const tags = [ ] ;
16+ const tags = new Set ( ) ;
1717 const temporaryDocument = {
1818 'x-send-defaults' : true ,
1919 'openapi' : '3.0.0' ,
@@ -59,25 +59,33 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
5959 BasicAuth : [ ] ,
6060 } ,
6161 ] ,
62- 'tags' : tags ,
62+ 'tags' : [ ] ,
6363 } ;
6464 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 ;
6767
6868 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+ }
7175 }
7276 }
77+ if ( ! isJsonRpc ) {
78+ continue prepare;
79+ }
80+ const apiName = module . meta . filename . replace ( / .j s $ / , '' ) ;
7381
7482 const schema = {
7583 post : {
7684 operationId : `${ module . meta . filename } ` ,
7785 deprecated : module . deprecated || false ,
7886 summary : `/${ apiName } ` ,
7987 description : module . description ,
80- tags : tags ,
88+ tags : Array . from ( tags ) ,
8189 parameters : [ ] ,
8290 responses : {
8391 '200' : {
0 commit comments