Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the list inside a File.ext YAML key pattern is not correctly parsed #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,22 @@
if (valuePathSplit.length > 1) {
// The value is inside an array
const arrayPrefix = utils.getArrayPrefix(valuePath);
let isPlainArray = true; // Assume it is plain until we prove the opposite
_.get(valuesJSON, arrayPrefix).forEach((e) => {
if (typeof e !== 'string') {
isPlainArray = false;
// Retrieve the value at arrayPrefix only if it's defined
const array = _.get(valuesJSON, arrayPrefix);
// Ensure array is actually defined and is an array
if (Array.isArray(array)) {
let isPlainArray = true; // Assume it is plain until we prove the opposite
array.forEach((e) => {
if (typeof e !== 'string') {
isPlainArray = false;
}
});
if (isPlainArray) {
value = array;
valuePath = arrayPrefix;
}
});
if (isPlainArray) {
value = _.get(valuesJSON, arrayPrefix);
valuePath = arrayPrefix;
} else {
console.error(`Expected array at ${arrayPrefix}, found ${typeof array}`);

Check warning on line 161 in lib/parser.js

View workflow job for this annotation

GitHub Actions / Verify

Unexpected console statement
}
}

Expand Down
Loading