Skip to content

Commit 7b02e68

Browse files
authored
update (#36639)
1 parent 030b314 commit 7b02e68

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

eng/tools/typespec-migration-validation/src/commonType.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import path from 'path';
2+
import { fileURLToPath } from 'url';
3+
import { dirname } from 'path';
24
import { readFileContent } from './helper.js';
35
import { OpenAPI2Document, OpenAPI2Schema } from '@azure-tools/typespec-autorest';
46
import { isRef } from './compare.js';
57

8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
611
export function getCommonTypeDefinition(refPath: string): [OpenAPI2Schema, OpenAPI2Document] | undefined {
712
const commonTypeInfo = getCommonTypeInfo(refPath);
813
if (!commonTypeInfo) {
@@ -41,7 +46,7 @@ function getCommonTypeInfo(refPath: string): [string, string] | undefined {
4146
return undefined;
4247
}
4348
const [, version, fileName, definitionName] = matchResult;
44-
return [path.join(process.cwd(), '..', '..', '..', 'specification', 'common-types', 'resource-management', version, fileName), definitionName];
49+
return [path.join(__dirname, '..', '..', '..', '..', '..', 'specification', 'common-types', 'resource-management', version, fileName), definitionName];
4550
}
4651

4752
const commonTypeFileCache: Record<string, OpenAPI2Document> = {};

0 commit comments

Comments
 (0)