-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
I suppose that this is an issue in the library we are using to validate object, (I will check the open issues tomorrow)
What happened:
foreachstateValidator is not working well when required files are based on if..then..else..
conditions
What you expected to happen:
According to the specification, foreachstate with
"name",
"type",
"inputCollection",
"iterationParam",
"actions",
"end"
is a valid object
How to reproduce it:
The code below
import {actionBuilder, foreachstateBuilder, produceeventdefBuilder} from '../../src';
fdescribe("", () => {
it('should xxx', function () {
const object = foreachstateBuilder()
.name("ProvisionOrdersState")
.inputCollection("${ .orders }")
.iterationParam("singleorder")
.outputCollection("${ .provisionedOrders }")
.actions([
actionBuilder()
.functionRef({
refName: "provisionOrderFunction",
arguments: {
"order": "${ .singleorder }",
},
},
)
.build(),
])
.end({
produceEvents: ([
produceeventdefBuilder()
.eventRef("provisioningCompleteEvent")
.data("${ .provisionedOrders }")
.build(),
]),
},
)
.build()
expect(object.name).toEqual("ProvisionOrdersState")
});
})
that generated the following object (a valid one)
{
"name": "ProvisionOrdersState",
"inputCollection": "${ .orders }",
"iterationParam": "singleorder",
"outputCollection": "${ .provisionedOrders }",
"actions": [
{
"functionRef": {
"refName": "provisionOrderFunction",
"arguments": {
"order": "${ .singleorder }"
}
}
}
],
"end": {
"produceEvents": [
{
"eventRef": "provisioningCompleteEvent",
"data": "${ .provisionedOrders }"
}
]
},
"type": "foreach"
}
fails with the following error
[
{
instancePath: '',
schemaPath: '#/then/required',
keyword: 'required',
params: { missingProperty: 'workflowId' },
message: "must have required property 'workflowId'"
}
]
F
Failures:
1) should xxx
Message:
Error: Foreachstate is invalid: must have required property 'workflowId'
Anything else we need to know?:
adding to the object construction
.usedForCompensation(false)
works fine.
Environment:
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request