@@ -135,13 +135,13 @@ export class Printer {
135135
136136 const refType = this . named . nextRefType ( name , id ) ;
137137 this . schemas [ id ] = refType ;
138- this . _registerAnchors ( id , refType , schema , [ ] ) ;
138+ this . #registerAnchors ( id , refType , schema , [ ] ) ;
139139 return refType ;
140140 } ,
141141 additional : ( id , refType ) => {
142142 this . schemas [ id ] = refType ;
143143 this . named . setRefType ( id , refType ) ;
144- this . _registerAnchors ( id , refType , schema , [ ] ) ;
144+ this . #registerAnchors ( id , refType , schema , [ ] ) ;
145145 } ,
146146 } ) ;
147147 }
@@ -229,7 +229,7 @@ export class Printer {
229229 }
230230 }
231231
232- private _registerAnchors (
232+ #registerAnchors (
233233 rootId : string ,
234234 rootType : string ,
235235 schema : OpenApiLatest_Schema ,
@@ -251,14 +251,14 @@ export class Printer {
251251 }
252252
253253 if ( 'items' in schema && schema . items ) {
254- this . _registerAnchors ( rootId , rootType , schema . items , [
254+ this . #registerAnchors ( rootId , rootType , schema . items , [
255255 ...props ,
256256 'number' ,
257257 ] ) ;
258258 }
259259 else if ( 'properties' in schema && schema . properties ) {
260260 for ( const [ prop , property ] of Object . entries ( schema . properties ) ) {
261- this . _registerAnchors ( rootId , rootType , property , [
261+ this . #registerAnchors ( rootId , rootType , property , [
262262 ...props ,
263263 JSON . stringify ( prop ) ,
264264 ] ) ;
@@ -282,18 +282,18 @@ export class Printer {
282282
283283 return [
284284 ! hideHeaders && header ,
285- ! hideInfo && this . _printInfo ( ) ,
286- ! hideImports && this . _printImports ( ) ,
285+ ! hideInfo && this . #printInfo ( ) ,
286+ ! hideImports && this . #printImports ( ) ,
287287 ! hideHelpers && Printer . helpersCode ,
288- ! hideComponents && this . _printComponents ( ) ,
289- ! hidePaths && this . _printPaths ( ) ,
288+ ! hideComponents && this . #printComponents ( ) ,
289+ ! hidePaths && this . #printPaths ( ) ,
290290 ! hideFooters && footer ,
291291 ]
292292 . filter ( Boolean )
293293 . join ( '\n\n' ) ;
294294 }
295295
296- private _printInfo ( ) {
296+ #printInfo ( ) {
297297 const {
298298 contact,
299299 description,
@@ -326,7 +326,7 @@ export class Printer {
326326 return jsDoc . print ( ) ;
327327 }
328328
329- private _printImports ( ) {
329+ #printImports ( ) {
330330 const {
331331 axiosImportName = '' ,
332332 axiosImportFile,
@@ -358,10 +358,10 @@ export class Printer {
358358 ] . join ( '\n' ) ;
359359 }
360360
361- private _printComponents ( ) {
361+ #printComponents ( ) {
362362 return Object . entries ( this . document . components ?. schemas || { } )
363363 . map ( ( [ name , schema ] ) => {
364- return this . _printComponent (
364+ return this . #printComponent (
365365 name ,
366366 `#/components/schemas/${ name } ` ,
367367 schema ,
@@ -370,7 +370,7 @@ export class Printer {
370370 . join ( '\n\n' ) ;
371371 }
372372
373- private _printComponent (
373+ #printComponent (
374374 name : string ,
375375 id : string ,
376376 schema : OpenApiLatest_Schema ,
@@ -389,17 +389,17 @@ export class Printer {
389389 . join ( '\n' ) ;
390390 }
391391
392- private _printPaths ( ) {
392+ #printPaths ( ) {
393393 return Object . entries ( this . document . paths || { } )
394394 . map ( ( [ url , pathItem ] ) => {
395- return this . _printPathItem ( url , pathItem )
395+ return this . #printPathItem ( url , pathItem )
396396 . filter ( filterLine )
397397 . join ( '\n\n' ) ;
398398 } )
399399 . join ( '\n\n' ) ;
400400 }
401401
402- private _printPathItem (
402+ #printPathItem (
403403 url : string ,
404404 pathItem : OpenApiLatest_PathItem ,
405405 ) : Array < string | undefined > {
@@ -410,7 +410,7 @@ export class Printer {
410410 throw new Error ( `未发现 pathItem 引用:${ pathItem . $ref } ` ) ;
411411 }
412412
413- return this . _printPathItem ( url , relPathItem ) ;
413+ return this . #printPathItem ( url , relPathItem ) ;
414414 }
415415
416416 return Object . entries ( pathItem ) . map ( ( [ method , _operation ] ) => {
@@ -426,11 +426,11 @@ export class Printer {
426426
427427 // 已经约束了是 http method
428428 const operation = _operation as OpenApiLatest_Operation ;
429- return this . _printOperation ( method , url , operation ) ;
429+ return this . #printOperation ( method , url , operation ) ;
430430 } ) ;
431431 }
432432
433- private _printOperation (
433+ #printOperation (
434434 method : string ,
435435 url : string ,
436436 operation : OpenApiLatest_Operation ,
@@ -458,7 +458,7 @@ export class Printer {
458458
459459 if ( parameters ) {
460460 for ( const parameter of parameters ) {
461- this . _parseParameter ( parameter , {
461+ this . #parseParameter ( parameter , {
462462 header,
463463 cookie,
464464 path,
@@ -468,7 +468,7 @@ export class Printer {
468468 }
469469
470470 if ( requestBody ) {
471- this . _parseRequestBody ( data , requestBody , ( contentType , content ) => {
471+ this . #parseRequestBody ( data , requestBody , ( contentType , content ) => {
472472 if ( isString ( requestContentType ) )
473473 return requestContentType === contentType ;
474474 if ( ! requestContentType )
@@ -484,7 +484,7 @@ export class Printer {
484484 }
485485
486486 if ( responses ) {
487- this . _parseResponses (
487+ this . #parseResponses (
488488 resp ,
489489 responses ,
490490 ( statusCode , response ) => {
@@ -547,7 +547,7 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
547547}` ;
548548 }
549549
550- private _parseContents (
550+ #parseContents (
551551 arg : Arg ,
552552 contents : {
553553 [ contentType : string ] :
@@ -567,10 +567,10 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
567567 if ( ! content )
568568 return ;
569569
570- this . _parseContent ( arg , content , comments ) ;
570+ this . #parseContent ( arg , content , comments ) ;
571571 }
572572
573- private _parseContent (
573+ #parseContent (
574574 arg : Arg ,
575575 content : OpenApiLatest_Media ,
576576 comments : {
@@ -594,7 +594,7 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
594594 } ) ;
595595 }
596596
597- private _parseParameter (
597+ #parseParameter (
598598 parameter : OpenApiLatest_Parameter ,
599599 args : Record < OpenAPILatest . ParameterObject [ 'in' ] , Arg > ,
600600 ) {
@@ -606,7 +606,7 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
606606 throw new Error ( `未发现 parameter 引用:${ $ref } ` ) ;
607607 }
608608
609- this . _parseParameter ( refParameter , args ) ;
609+ this . #parseParameter ( refParameter , args ) ;
610610 return ;
611611 }
612612
@@ -615,7 +615,7 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
615615 }
616616 }
617617
618- private _parseRequestBody (
618+ #parseRequestBody (
619619 arg : Arg ,
620620 requestBody : OpenApiLatest_Request ,
621621 match : RequestMediaMatch ,
@@ -630,14 +630,14 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
630630 if ( ! refRequestBody )
631631 throw new Error ( `未发现 requestBody 引用:${ $ref } ` ) ;
632632
633- this . _parseRequestBody ( arg , refRequestBody , match ) ;
633+ this . #parseRequestBody ( arg , refRequestBody , match ) ;
634634 return ;
635635 }
636636
637- this . _parseContents ( arg , requestBody . content , requestBody , match ) ;
637+ this . #parseContents ( arg , requestBody . content , requestBody , match ) ;
638638 }
639639
640- private _parseResponses (
640+ #parseResponses (
641641 arg : Arg ,
642642 responses : OpenAPILatest . ResponsesObject ,
643643 responseMatch : ResponseMatch ,
@@ -652,10 +652,10 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
652652 if ( ! response )
653653 return ;
654654
655- this . _parseResponse ( arg , response , contentMatch ) ;
655+ this . #parseResponse ( arg , response , contentMatch ) ;
656656 }
657657
658- private _parseResponse (
658+ #parseResponse (
659659 arg : Arg ,
660660 response : OpenApiLatest_Response ,
661661 contentMatch : ResponseMediaMatch ,
@@ -667,15 +667,15 @@ export async function ${funcName}(${requestArgs.toArgs()}): ${AXIOS_RESPONSE_TYP
667667 if ( ! refResponse )
668668 throw new Error ( `未发现 response 引用:${ $ref } ` ) ;
669669
670- this . _parseResponse ( arg , refResponse , contentMatch ) ;
670+ this . #parseResponse ( arg , refResponse , contentMatch ) ;
671671 return ;
672672 }
673673
674674 const { content } = response ;
675675 if ( ! content )
676676 return ;
677677
678- this . _parseContents ( arg , content , response , ( contentType , content ) =>
678+ this . #parseContents ( arg , content , response , ( contentType , content ) =>
679679 contentMatch ( contentType , content , response ) ) ;
680680 }
681681
0 commit comments