Skip to content
Merged
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
6 changes: 5 additions & 1 deletion modules/st2-auto-form/fields/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const typeChecks = (type, value) => {
case 'integer':
return !validator.isInt(v) && `'${v}' is not an integer`;
case 'object':
return !_.isPlainObject(v) && `'${v}' is not an object`;
return !_.isPlainObject(value) && `'${v}' is not an object`;
case 'string':
default:
return false;
Expand Down Expand Up @@ -79,6 +79,10 @@ export default class ArrayField extends BaseTextField {
return v;
}

if (Array.isArray(v) && this.props.spec.items.type === 'object') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the offending line in the scenario where actions may not above spec.items defined

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You guys are right, I did not test with the yaml definition not having the type of item. Let me take another look on how I can distinguish what type of items are in the array.

return JSON.stringify(v);
}

const { secret } = this.props.spec || {};
if (secret && v && !Array.isArray(v)) {
return v;
Expand Down