Skip to content

Commit

Permalink
Merge pull request #30 from tajnymag/bugfix/issue-2052
Browse files Browse the repository at this point in the history
Bugfix/issue 2052
  • Loading branch information
mrlubos authored Mar 2, 2024
2 parents e345a7d + 43a5786 commit 2571d3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^10.1.0",
"@apidevtools/json-schema-ref-parser": "^11.1.0",
"camelcase": "^6.3.0",
"commander": "^11.1.0",
"fs-extra": "^11.2.0",
Expand Down
6 changes: 5 additions & 1 deletion src/utils/getOpenApiSpec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import RefParser from '@apidevtools/json-schema-ref-parser';
import { resolve } from 'path';

import { exists } from './fileSystem';

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

0 comments on commit 2571d3e

Please sign in to comment.