diff --git a/dev/openapi-ts.config.ts b/dev/openapi-ts.config.ts --- a/dev/openapi-ts.config.ts +++ b/dev/openapi-ts.config.ts @@ -35,19 +35,20 @@ // }, path: path.resolve( getSpecsPath(), - // '3.0.x', - '3.1.x', + '3.0.x', + // '3.1.x', // 'circular.yaml', // 'dutchie.json', // 'enum-names-values.yaml', // 'invalid', // 'full.yaml', + 'sdk-method-class-conflict.yaml', // 'object-property-names.yaml', // 'openai.yaml', // 'opencode.yaml', // 'pagination-ref.yaml', // 'sdk-instance.yaml', - 'sdk-nested-classes.yaml', + // 'sdk-nested-classes.yaml', // 'string-with-format.yaml', // 'transformers.json', // 'transformers-recursive.json', diff --git a/packages/codegen-core/src/files/file.ts b/packages/codegen-core/src/files/file.ts --- a/packages/codegen-core/src/files/file.ts +++ b/packages/codegen-core/src/files/file.ts @@ -1,3 +1,5 @@ +import path from 'node:path'; + import type { ExportModule, ImportModule } from '../bindings'; import { fileBrand } from '../brands'; import { debug } from '../debug'; @@ -63,7 +65,7 @@ this.external = input.external ?? false; this.id = id; if (input.language !== undefined) this._language = input.language; - this._logicalFilePath = input.logicalFilePath; + this._logicalFilePath = input.logicalFilePath.split(path.sep).join('/'); if (input.name !== undefined) this._name = input.name; this.project = project; } diff --git a/packages/codegen-core/src/files/registry.ts b/packages/codegen-core/src/files/registry.ts --- a/packages/codegen-core/src/files/registry.ts +++ b/packages/codegen-core/src/files/registry.ts @@ -1,3 +1,5 @@ +import path from 'node:path'; + import type { IProject } from '../project/types'; import { File } from './file'; import type { FileKeyArgs, IFileIn, IFileRegistry } from './types'; @@ -50,6 +52,7 @@ } private createFileKey(args: FileKeyArgs): string { - return `${args.external ? 'ext:' : ''}${args.logicalFilePath}${args.language ? `:${args.language}` : ''}`; + const logicalPath = args.logicalFilePath.split(path.sep).join('/'); + return `${args.external ? 'ext:' : ''}${logicalPath}${args.language ? `:${args.language}` : ''}`; } } diff --git a/packages/openapi-ts/src/ts-dsl/render/utils.ts b/packages/openapi-ts/src/ts-dsl/render/utils.ts --- a/packages/openapi-ts/src/ts-dsl/render/utils.ts +++ b/packages/openapi-ts/src/ts-dsl/render/utils.ts @@ -97,9 +97,8 @@ preferFileExtension: string; root: string; }): SortKey => { - const fromPath = fromFile.finalPath!; - const filePath = file.finalPath!; - let modulePath = fromPath; + const filePath = file.finalPath!.split(path.sep).join('/'); + let modulePath = fromFile.finalPath!.split(path.sep).join('/'); // built-ins // TODO: based on nodeBuiltins set @@ -110,7 +109,7 @@ } // outside project root - if (!modulePath.startsWith(root)) { + if (!modulePath.startsWith(root.split(path.sep).join('/'))) { return [1, 0, modulePath]; }