@@ -455,17 +455,17 @@ const onEach: Overrider = ({ zodSchema, jsonSchema }, { isResponse }) => {
455455 * @todo is there a less hacky way to do that?
456456 * */
457457const fixReferences = (
458- $defs : Record < string , JSONSchema . BaseSchema > ,
459- rest : JSONSchema . BaseSchema ,
458+ subject : JSONSchema . BaseSchema ,
459+ defs : Record < string , JSONSchema . BaseSchema > ,
460460 ctx : OpenAPIContext ,
461461) => {
462- const stack : unknown [ ] = [ rest , $ defs] ;
462+ const stack : unknown [ ] = [ subject , defs ] ;
463463 while ( stack . length ) {
464464 const entry = stack . shift ( ) ! ;
465465 if ( R . is ( Object , entry ) ) {
466466 if ( isReferenceObject ( entry ) && ! entry . $ref . startsWith ( "#/components" ) ) {
467467 const actualName = entry . $ref . split ( "/" ) . pop ( ) ! ;
468- const depiction = $ defs[ actualName ] ;
468+ const depiction = defs [ actualName ] ;
469469 if ( depiction )
470470 entry . $ref = ctx . makeRef ( depiction , depiction as SchemaObject ) . $ref ; // @todo see below
471471 continue ;
@@ -474,7 +474,7 @@ const fixReferences = (
474474 }
475475 if ( R . is ( Array , entry ) ) stack . push ( ...R . values ( entry ) ) ;
476476 }
477- return rest as SchemaObject ; // @todo ideally, there should be a method to ensure that
477+ return subject as SchemaObject ; // @todo ideally, there should be a method to ensure that
478478} ;
479479
480480// @todo rename?
@@ -498,7 +498,7 @@ const delegate = (
498498 } ,
499499 } ,
500500 ) as JSONSchema . ObjectSchema ;
501- return fixReferences ( $defs , properties [ "subject" ] , ctx ) ;
501+ return fixReferences ( properties [ "subject" ] , $defs , ctx ) ;
502502} ;
503503
504504export const excludeParamsFromDepiction = (
0 commit comments