Skip to content

Commit 28c6b82

Browse files
committed
chore: normalize external path
1 parent 052341e commit 28c6b82

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

dev/openapi-ts.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@ export default defineConfig(() => {
3535
// },
3636
path: path.resolve(
3737
getSpecsPath(),
38-
// '3.0.x',
39-
'3.1.x',
38+
'3.0.x',
39+
// '3.1.x',
4040
// 'circular.yaml',
4141
// 'dutchie.json',
4242
// 'enum-names-values.yaml',
4343
// 'invalid',
4444
// 'full.yaml',
45+
'sdk-method-class-conflict.yaml',
4546
// 'object-property-names.yaml',
4647
// 'openai.yaml',
4748
// 'opencode.yaml',
4849
// 'pagination-ref.yaml',
4950
// 'sdk-instance.yaml',
50-
'sdk-nested-classes.yaml',
51+
// 'sdk-nested-classes.yaml',
5152
// 'string-with-format.yaml',
5253
// 'transformers.json',
5354
// 'transformers-recursive.json',

packages/codegen-core/src/files/registry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from 'node:path';
2+
13
import type { IProject } from '../project/types';
24
import { File } from './file';
35
import type { FileKeyArgs, IFileIn, IFileRegistry } from './types';
@@ -50,6 +52,7 @@ export class FileRegistry implements IFileRegistry {
5052
}
5153

5254
private createFileKey(args: FileKeyArgs): string {
53-
return `${args.external ? 'ext:' : ''}${args.logicalFilePath}${args.language ? `:${args.language}` : ''}`;
55+
const logicalPath = args.logicalFilePath.split(path.sep).join('/');
56+
return `${args.external ? 'ext:' : ''}${logicalPath}${args.language ? `:${args.language}` : ''}`;
5457
}
5558
}

packages/openapi-ts/src/ts-dsl/render/typescript.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from 'node:path';
2+
13
import type { RenderContext, Renderer } from '@hey-api/codegen-core';
24
import ts from 'typescript';
35

@@ -97,7 +99,7 @@ export class TypeScriptRenderer implements Renderer {
9799
file: ctx.file,
98100
fromFile: exp.from,
99101
preferFileExtension: this.preferFileExtension,
100-
root: ctx.project.root,
102+
root: ctx.project.root.split(path.sep).join('/'),
101103
});
102104
const modulePath = this.resolveModuleName?.(sortKey[2]) ?? sortKey[2];
103105
const [groupIndex] = sortKey;
@@ -169,7 +171,7 @@ export class TypeScriptRenderer implements Renderer {
169171
file: ctx.file,
170172
fromFile: imp.from,
171173
preferFileExtension: this.preferFileExtension,
172-
root: ctx.project.root,
174+
root: ctx.project.root.split(path.sep).join('/'),
173175
});
174176
const modulePath = this.resolveModuleName?.(sortKey[2]) ?? sortKey[2];
175177
const [groupIndex] = sortKey;

packages/openapi-ts/src/ts-dsl/render/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const moduleSortKey = ({
9999
}): SortKey => {
100100
const fromPath = fromFile.finalPath!;
101101
const filePath = file.finalPath!;
102-
let modulePath = fromPath;
102+
let modulePath = fromPath.split(path.sep).join('/');
103103

104104
// built-ins
105105
// TODO: based on nodeBuiltins set

0 commit comments

Comments
 (0)