Skip to content

VIP input maps handling#658

Open
Albireo-B wants to merge 3 commits into
virtual-imaging-platform:developfrom
Albireo-B:Refactor/Vip_optional_inputs
Open

VIP input maps handling#658
Albireo-B wants to merge 3 commits into
virtual-imaging-platform:developfrom
Albireo-B:Refactor/Vip_optional_inputs

Conversation

@Albireo-B
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Contributor

@axlbonnet axlbonnet left a comment

Choose a reason for hiding this comment

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

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()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think e.getInputValues() is empty at this point.
Anyway we have to solve the workflows-db issue before (see the moteurlite PR).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Some null checks were introduced by the latest PR

inputMap.put(
restInput.getKey(),
handleRestParameter(restInput.getKey(), restInput.getValue()));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if there are several inputs objets, then we must verify all inputs have only 1 element.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added an exception throw

inputValues.put(pp.getName(), pp.getDefaultValue().toString());
for (Map<String, String> inputMap : inputValues) {
inputMap.put(pp.getName(), pp.getDefaultValue().toString());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it does not handle the case if some input object have a value and some not.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Indeed, modified to handle only missing key values

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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());

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes it makes sense

private ExecutionStatus status;
@NotNull
private Map<String, java.lang.Object> inputValues;
private List<Map<String, Object>> inputValues;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Object and have methods in Execution that help manage the different cases.
  • implement specific Execution Jackson Serializer and Deserializer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Created InputValuesDeserializer which handles deserializing to List<Map<String,Object>>

@Albireo-B Albireo-B force-pushed the Refactor/Vip_optional_inputs branch from 90081ad to 6b298e6 Compare April 28, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants