Skip to content

Commit

Permalink
fix: fixed relative basepath cli option bug (#160)
Browse files Browse the repository at this point in the history
fixes #45
  • Loading branch information
NektariosFifes authored Mar 8, 2023
1 parent 975ed51 commit 061b0fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const verifyInputGetData = async (rd, asyncApiFilepath,scenarioFile,basedir) =>

scenarioFile = await inputLoopScenario(rd,scenarioFile,yamlJsonRegex,basedir);

const dataFromParser = await parserAndGenerator(asyncApiFilepath,scenarioFile);
const dataFromParser = await parserAndGenerator(asyncApiFilepath,scenarioFile,basedir);

const availableServers = Object.keys(dataFromParser.servers);

Expand Down
4 changes: 2 additions & 2 deletions src/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function getParameterDefinitions(channels) {
return paramDefinitions;
}

const parserAndGenerator = async (asyncApiFilepath,scenarioFilepath) => {
const [asyncApiContent,scenarioContent] = await parseFiles(asyncApiFilepath,scenarioFilepath);
const parserAndGenerator = async (asyncApiFilepath,scenarioFilepath,basedir) => {
const [asyncApiContent,scenarioContent] = await parseFiles(asyncApiFilepath,scenarioFilepath,basedir);
const operationsData = {
servers: asyncApiContent._json.servers,
parameterDefinitions: {},
Expand Down
5 changes: 2 additions & 3 deletions src/parser/parseFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const yamlParser = require('js-yaml');
* @param filepathScenario
* @returns {Promise<(*|*|string|Chai.Assertion)[]>}
*/
const parseFiles = async (filepathAsyncApi, filepathScenario) => {
const parseFiles = async (filepathAsyncApi, filepathScenario,basedir) => {
const ajv = new Ajv({allowMatchingProperties: true,strict: true,allErrors: true, verbose: true});
let asyncApiContent;
try {
Expand All @@ -18,8 +18,7 @@ const parseFiles = async (filepathAsyncApi, filepathScenario) => {
} catch (err) {
console.log(`\nError in reading the asyncApi file. Details: ${err}`);
}
const asyncApiParsed = await parser.parse(asyncApiContent);

const asyncApiParsed = await parser.parse(asyncApiContent, {path: basedir});
let scenarioParsed;
try {
// eslint-disable-next-line security/detect-non-literal-fs-filename
Expand Down

0 comments on commit 061b0fa

Please sign in to comment.