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

fix: JSON Collection Unwrapping Consistency in Programmatic Interface #3189

Open
wants to merge 1 commit into
base: develop
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
11 changes: 10 additions & 1 deletion lib/run/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,21 @@ var _ = require('lodash'),
*/
extractModel = function (source, type) {
source = source[type] || source; // extract object that holds variable. these usually come from cloud API

if (_.isObject(source) && !source.values) {
// Check if the source is an object and doesn't have a "values" property
// If it's an object, unwrap it if needed
source = source.collection || source;
}

if (!_.isObject(source)) {
return undefined;
}

// ensure we un-box the JSON if it comes from cloud-api or similar sources
!source.values && _.isObject(source[type]) && (source = source[type]);
if (!source.values && _.isObject(source[type])) {
source = source[type];
}

// we ensure that environment passed as array is converted to plain object. runtime does this too, but we do it
// here for consistency of options passed to reporters
Expand Down