Skip to content

Commit 15fa2ac

Browse files
committed
Fixed issue 2052
Both of these had to be made together to pass our tests 1. always pass absolute url to json-schema-ref-parser 2. update json-schema-ref-parser to v11.1.0
1 parent 9e475d9 commit 15fa2ac

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
6161
},
6262
"dependencies": {
63-
"@apidevtools/json-schema-ref-parser": "^10.1.0",
63+
"@apidevtools/json-schema-ref-parser": "^11.1.0",
6464
"camelcase": "^6.3.0",
6565
"commander": "^11.1.0",
6666
"fs-extra": "^11.2.0",

src/utils/getOpenApiSpec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import RefParser from '@apidevtools/json-schema-ref-parser';
2+
import { exists } from 'fs-extra';
3+
import path from 'path';
24

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

0 commit comments

Comments
 (0)