tangled
alpha
login
or
join now
mokkenstorm.dev
/
openapi-ts
0
fork
atom
fork of hey-api/openapi-ts because I need some additional things
0
fork
atom
overview
issues
pulls
pipelines
chore: normalize external path
Lubos
3 months ago
8e44ea8f
052341eb
+14
-9
4 changed files
expand all
collapse all
unified
split
dev
openapi-ts.config.ts
packages
codegen-core
src
files
file.ts
registry.ts
openapi-ts
src
ts-dsl
render
utils.ts
+4
-3
dev/openapi-ts.config.ts
···
35
// },
36
path: path.resolve(
37
getSpecsPath(),
38
-
// '3.0.x',
39
-
'3.1.x',
40
// 'circular.yaml',
41
// 'dutchie.json',
42
// 'enum-names-values.yaml',
43
// 'invalid',
44
// 'full.yaml',
0
45
// 'object-property-names.yaml',
46
// 'openai.yaml',
47
// 'opencode.yaml',
48
// 'pagination-ref.yaml',
49
// 'sdk-instance.yaml',
50
-
'sdk-nested-classes.yaml',
51
// 'string-with-format.yaml',
52
// 'transformers.json',
53
// 'transformers-recursive.json',
···
35
// },
36
path: path.resolve(
37
getSpecsPath(),
38
+
'3.0.x',
39
+
// '3.1.x',
40
// 'circular.yaml',
41
// 'dutchie.json',
42
// 'enum-names-values.yaml',
43
// 'invalid',
44
// 'full.yaml',
45
+
'sdk-method-class-conflict.yaml',
46
// 'object-property-names.yaml',
47
// 'openai.yaml',
48
// 'opencode.yaml',
49
// 'pagination-ref.yaml',
50
// 'sdk-instance.yaml',
51
+
// 'sdk-nested-classes.yaml',
52
// 'string-with-format.yaml',
53
// 'transformers.json',
54
// 'transformers-recursive.json',
+3
-1
packages/codegen-core/src/files/file.ts
···
0
0
1
import type { ExportModule, ImportModule } from '../bindings';
2
import { fileBrand } from '../brands';
3
import { debug } from '../debug';
···
63
this.external = input.external ?? false;
64
this.id = id;
65
if (input.language !== undefined) this._language = input.language;
66
-
this._logicalFilePath = input.logicalFilePath;
67
if (input.name !== undefined) this._name = input.name;
68
this.project = project;
69
}
···
1
+
import path from 'node:path';
2
+
3
import type { ExportModule, ImportModule } from '../bindings';
4
import { fileBrand } from '../brands';
5
import { debug } from '../debug';
···
65
this.external = input.external ?? false;
66
this.id = id;
67
if (input.language !== undefined) this._language = input.language;
68
+
this._logicalFilePath = input.logicalFilePath.split(path.sep).join('/');
69
if (input.name !== undefined) this._name = input.name;
70
this.project = project;
71
}
+4
-1
packages/codegen-core/src/files/registry.ts
···
0
0
1
import type { IProject } from '../project/types';
2
import { File } from './file';
3
import type { FileKeyArgs, IFileIn, IFileRegistry } from './types';
···
50
}
51
52
private createFileKey(args: FileKeyArgs): string {
53
-
return `${args.external ? 'ext:' : ''}${args.logicalFilePath}${args.language ? `:${args.language}` : ''}`;
0
54
}
55
}
···
1
+
import path from 'node:path';
2
+
3
import type { IProject } from '../project/types';
4
import { File } from './file';
5
import type { FileKeyArgs, IFileIn, IFileRegistry } from './types';
···
52
}
53
54
private createFileKey(args: FileKeyArgs): string {
55
+
const logicalPath = args.logicalFilePath.split(path.sep).join('/');
56
+
return `${args.external ? 'ext:' : ''}${logicalPath}${args.language ? `:${args.language}` : ''}`;
57
}
58
}
+3
-4
packages/openapi-ts/src/ts-dsl/render/utils.ts
···
97
preferFileExtension: string;
98
root: string;
99
}): SortKey => {
100
-
const fromPath = fromFile.finalPath!;
101
-
const filePath = file.finalPath!;
102
-
let modulePath = fromPath;
103
104
// built-ins
105
// TODO: based on nodeBuiltins set
···
110
}
111
112
// outside project root
113
-
if (!modulePath.startsWith(root)) {
114
return [1, 0, modulePath];
115
}
116
···
97
preferFileExtension: string;
98
root: string;
99
}): SortKey => {
100
+
const filePath = file.finalPath!.split(path.sep).join('/');
101
+
let modulePath = fromFile.finalPath!.split(path.sep).join('/');
0
102
103
// built-ins
104
// TODO: based on nodeBuiltins set
···
109
}
110
111
// outside project root
112
+
if (!modulePath.startsWith(root.split(path.sep).join('/'))) {
113
return [1, 0, modulePath];
114
}
115