We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a9af76d + 99695b6 commit 800d969Copy full SHA for 800d969
src/utils/getOpenApiSpec.ts
@@ -1,4 +1,7 @@
1
import RefParser from '@apidevtools/json-schema-ref-parser';
2
+import { resolve } from 'path';
3
+
4
+import { exists } from './fileSystem';
5
6
/**
7
* 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';
10
* @param location: Path or url
8
11
*/
9
12
export const getOpenApiSpec = async (location: string): Promise<any> => {
- return await RefParser.bundle(location, location, {});
13
+ const absolutePathOrUrl = (await exists(location)) ? resolve(location) : location;
14
+ return await RefParser.bundle(absolutePathOrUrl, absolutePathOrUrl, {});
15
};
0 commit comments