VIP input maps handling#658
Conversation
axlbonnet
left a comment
There was a problem hiding this comment.
Some things to discuss.
| logger.debug("Execution has " + inputs.size() + " inputs "); | ||
| for (InOutData iod : inputs) { | ||
| e.getInputValues().put(iod.getProcessor(), iod.getPath()); | ||
| for (Map<String, Object> inputMap : e.getInputValues()) { |
There was a problem hiding this comment.
i think e.getInputValues() is empty at this point.
Anyway we have to solve the workflows-db issue before (see the moteurlite PR).
There was a problem hiding this comment.
Some null checks were introduced by the latest PR
| inputMap.put( | ||
| restInput.getKey(), | ||
| handleRestParameter(restInput.getKey(), restInput.getValue())); | ||
| } |
There was a problem hiding this comment.
if there are several inputs objets, then we must verify all inputs have only 1 element.
| inputValues.put(pp.getName(), pp.getDefaultValue().toString()); | ||
| for (Map<String, String> inputMap : inputValues) { | ||
| inputMap.put(pp.getName(), pp.getDefaultValue().toString()); | ||
| } |
There was a problem hiding this comment.
I think it does not handle the case if some input object have a value and some not.
There was a problem hiding this comment.
Indeed, modified to handle only missing key values
There was a problem hiding this comment.
I find it more logic to do the test before the loop, like:
if (pp.getDefaultValue() != null) {
mapsWithoutKey.stream.forEach(...)
continue;
}
// then ok if it is optional
if (pp.isOptional()) {
continue;
}
// error : pp is an empty input with no default value and it is not optional
logger.error("Error initialising {}, missing {} parameter", pipelineId, pp.getName());
throw new VipException(ApiError.INPUT_FIELD_MISSING, pp.getName());
| private ExecutionStatus status; | ||
| @NotNull | ||
| private Map<String, java.lang.Object> inputValues; | ||
| private List<Map<String, Object>> inputValues; |
There was a problem hiding this comment.
I would like to not break the API with this change, and support an object as before, and a list.
I see 2 solutions, but there may be others:
- have inputValues as
Objectand have methods in Execution that help manage the different cases. - implement specific Execution Jackson Serializer and Deserializer.
There was a problem hiding this comment.
Created InputValuesDeserializer which handles deserializing to List<Map<String,Object>>
90081ad to
6b298e6
Compare
No description provided.