@@ -176,9 +176,9 @@ function replace$Refs(obj: unknown, relativeFrom: string, componentFiles = {} as
176176 const groupName = splittedNode [ 2 ] ;
177177 const filesGroupName = componentFiles [ groupName ] ;
178178 if ( ! filesGroupName || ! filesGroupName [ name ! ] ) return ;
179- let filename = path . relative ( relativeFrom , filesGroupName [ name ! ] . filename ) ;
179+ let filename = slash ( path . relative ( relativeFrom , filesGroupName [ name ! ] . filename ) ) ;
180180 if ( ! filename . startsWith ( '.' ) ) {
181- filename = '.' + path . sep + filename ;
181+ filename = './' + filename ;
182182 }
183183 node [ key ] = filename ;
184184 }
@@ -192,11 +192,11 @@ function implicitlyReferenceDiscriminator(
192192) {
193193 if ( ! obj . discriminator ) return ;
194194 const defPtr = `#/${ COMPONENTS } /${ OPENAPI3_COMPONENT . Schemas } /${ defName } ` ;
195- const implicitMapping = { } as any ;
195+ const implicitMapping : Record < string , string > = { } ;
196196 for ( const [ name , { inherits, filename : parentFilename } ] of Object . entries ( schemaFiles ) as any ) {
197197 if ( inherits . indexOf ( defPtr ) > - 1 ) {
198- const res = path . relative ( path . dirname ( filename ) , parentFilename ) ;
199- implicitMapping [ name ] = res . startsWith ( '.' ) ? res : '.' + path . sep + res ;
198+ const res = slash ( path . relative ( path . dirname ( filename ) , parentFilename ) ) ;
199+ implicitMapping [ name ] = res . startsWith ( '.' ) ? res : './' + res ;
200200 }
201201 }
202202
@@ -258,7 +258,7 @@ function extractFileNameFromPath(filename: string) {
258258}
259259
260260function getFileNamePath ( componentDirPath : string , componentName : string , ext : string ) {
261- return path . join ( componentDirPath , componentName ) + `.${ ext } ` ;
261+ return slash ( path . join ( componentDirPath , componentName ) + `.${ ext } ` ) ;
262262}
263263
264264function gatherComponentsFiles (
@@ -273,7 +273,7 @@ function gatherComponentsFiles(
273273 inherits = (
274274 ( components ?. [ componentType ] ?. [ componentName ] as Oas3Schema | Oas3_1Schema ) ?. allOf || [ ]
275275 )
276- . map ( ( { $ref } ) => $ref )
276+ . map ( ( { $ref } ) => $ref && slash ( $ref ) )
277277 . filter ( isTruthy ) ;
278278 }
279279 componentsFiles [ componentType ] = componentsFiles [ componentType ] || { } ;
0 commit comments