1+ import * as fs from "node:fs" ;
2+ import path from "node:path" ;
13import type { resolve } from "@apidevtools/swagger-parser" ;
24import SwaggerParser from "@apidevtools/swagger-parser" ;
35import consola from "consola" ;
4- import * as fs from "node:fs" ;
5- import path from "node:path" ;
66import type { OpenAPI } from "openapi-types" ;
77import * as YAML from "yaml" ;
88import type { AnyObject , Maybe , Primitive } from "yummies/types" ;
@@ -86,8 +86,9 @@ export class ResolvedSwaggerSchema {
8686 Authorization : this . config . authorizationToken ,
8787 }
8888 : { } ,
89- ( this . config . requestOptions ?. headers as Record < string , string > | undefined ) ||
90- { } ,
89+ ( this . config . requestOptions ?. headers as
90+ | Record < string , string >
91+ | undefined ) || { } ,
9192 ) ;
9293 }
9394
@@ -124,7 +125,9 @@ export class ResolvedSwaggerSchema {
124125 return [ ...refs ] ;
125126 }
126127
127- private async fetchRemoteSchemaDocument ( url : string ) : Promise < Maybe < AnyObject > > {
128+ private async fetchRemoteSchemaDocument (
129+ url : string ,
130+ ) : Promise < Maybe < AnyObject > > {
128131 try {
129132 const response = await fetch ( url , {
130133 headers : this . getRemoteRequestHeaders ( ) ,
@@ -155,7 +158,10 @@ export class ResolvedSwaggerSchema {
155158 }
156159
157160 private async warmUpRemoteSchemasCache ( ) {
158- if ( typeof this . config . url !== "string" || ! this . isHttpUrl ( this . config . url ) ) {
161+ if (
162+ typeof this . config . url !== "string" ||
163+ ! this . isHttpUrl ( this . config . url )
164+ ) {
159165 return ;
160166 }
161167
@@ -212,7 +218,8 @@ export class ResolvedSwaggerSchema {
212218 return [ ] ;
213219 }
214220
215- const [ relativePath = "" , rawPointer = "" ] = this . normalizeRef ( ref ) . split ( "#" ) ;
221+ const [ relativePath = "" , rawPointer = "" ] =
222+ this . normalizeRef ( ref ) . split ( "#" ) ;
216223 if ( ! relativePath ) {
217224 return [ ] ;
218225 }
@@ -225,7 +232,10 @@ export class ResolvedSwaggerSchema {
225232
226233 const bases = new Set < string > ( ) ;
227234
228- if ( typeof this . config . url === "string" && this . isHttpUrl ( this . config . url ) ) {
235+ if (
236+ typeof this . config . url === "string" &&
237+ this . isHttpUrl ( this . config . url )
238+ ) {
229239 bases . add ( this . config . url ) ;
230240 }
231241
@@ -240,7 +250,10 @@ export class ResolvedSwaggerSchema {
240250 const resolverPaths =
241251 typeof resolver . paths === "function" ? resolver . paths ( ) : [ ] ;
242252 for ( const resolverPath of resolverPaths ) {
243- if ( typeof resolverPath === "string" && this . isHttpUrl ( resolverPath ) ) {
253+ if (
254+ typeof resolverPath === "string" &&
255+ this . isHttpUrl ( resolverPath )
256+ ) {
244257 bases . add ( resolverPath ) ;
245258 }
246259 }
@@ -398,15 +411,17 @@ export class ResolvedSwaggerSchema {
398411 }
399412 }
400413
401- const remoteAbsoluteCandidates = this . collectRemoteAbsoluteRefCandidates ( ref ) ;
414+ const remoteAbsoluteCandidates =
415+ this . collectRemoteAbsoluteRefCandidates ( ref ) ;
402416 for ( const remoteAbsoluteRef of remoteAbsoluteCandidates ) {
403417 const resolvedFromRemoteCache =
404418 this . resolveFromRemoteSchemaCache ( remoteAbsoluteRef ) ;
405419 if ( resolvedFromRemoteCache ) {
406420 return resolvedFromRemoteCache ;
407421 }
408422
409- const resolvedByRemoteAbsoluteRef = this . tryToResolveRef ( remoteAbsoluteRef ) ;
423+ const resolvedByRemoteAbsoluteRef =
424+ this . tryToResolveRef ( remoteAbsoluteRef ) ;
410425 if ( resolvedByRemoteAbsoluteRef ) {
411426 return this . normalizeResolvedExternalSchemaRef (
412427 remoteAbsoluteRef ,
0 commit comments