Skip to content

Commit 800d969

Browse files
authored
Merge pull request #2053 from tajnymag/bugfix/issue-2052
Fixed issue 2052
2 parents a9af76d + 99695b6 commit 800d969

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/getOpenApiSpec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import RefParser from '@apidevtools/json-schema-ref-parser';
2+
import { resolve } from 'path';
3+
4+
import { exists } from './fileSystem';
25

36
/**
47
* Load and parse te open api spec. If the file extension is ".yml" or ".yaml"
@@ -7,5 +10,6 @@ import RefParser from '@apidevtools/json-schema-ref-parser';
710
* @param location: Path or url
811
*/
912
export const getOpenApiSpec = async (location: string): Promise<any> => {
10-
return await RefParser.bundle(location, location, {});
13+
const absolutePathOrUrl = (await exists(location)) ? resolve(location) : location;
14+
return await RefParser.bundle(absolutePathOrUrl, absolutePathOrUrl, {});
1115
};

0 commit comments

Comments
 (0)