Repository: kestra-io/kestra
File: core/src/main/java/io/kestra/core/runners/FlowInputOutput.java (Java)

Code before:
     * @param flow      The Flow.
     * @param execution The Execution.
     * @param data      The Execution's inputs data.
     * @return The Map of typed inputs.
     */
    public Map<String, Object> readExecutionInputs(
        final FlowInterface flow,
        final Execution execution,
        final Map<String, ?> data
    ) {
       return readExecutionInputs(flow.getInputs(), flow, execution, data);
    }

    private Map<String, Object> readExecutionInputs(
        final List<Input<?>> inputs,
        final FlowInterface flow,
        final Execution execution,
        final Map<String, ?> data
    ) {
        Map<String, Object> resolved = this.resolveInputs(inputs, flow, execution, data, true)
            .stream()
            .filter(InputAndValue::enabled)
            .map(it -> {
                //TODO check to return all exception at-once.
                if (it.exceptions() != null && !it.exceptions().isEmpty()) {
                    String combinedMessage = it.exceptions().stream()
                        .map(InputOutputValidationException::getMessage)
                        .collect(Collectors.joining("\n"));
                    throw new InputOutputValidationException(combinedMessage);
                }
                return new AbstractMap.SimpleEntry<>(it.input().getId(), it.value());
            })
            .collect(HashMap::new, (m,v)-> m.put(v.getKey(), v.getValue()), HashMap::putAll);
        if (resolved.size() < data.size()) {
            RunContext runContext = runContextFactory.of(flow, execution);
            for (var inputKey : data.keySet()) {
                if (!resolved.containsKey(inputKey)) {
                    runContext.logger().warn(
                        "Input {} was provided for workflow {}.{} but isn't declared in the workflow inputs",
                        inputKey,
                        flow.getNamespace(),
                        flow.getId()
                    );
                }
            }
        }
        return MapUtils.flattenToNestedMap(resolved);
    }

    /**
     * Utility method for retrieving types inputs.

Review comment (refactor):
Could you please, create a static helper method for that in the `InputOutputValidationException` (e.g., `merge(List<InputOutputValidationException> exceptions)`` and create a simple unit-test please

Code after:
     * @param data      The Execution's inputs data.
     * @return The Map of typed inputs.
     */
    public Map<String, Object> readExecutionInputs(
        final FlowInterface flow,
        final Execution execution,
        final Map<String, ?> data
    ) {
       return readExecutionInputs(flow.getInputs(), flow, execution, data);
    }

    private Map<String, Object> readExecutionInputs(
        final List<Input<?>> inputs,
        final FlowInterface flow,
        final Execution execution,
        final Map<String, ?> data
    ) {
        Map<String, Object> resolved = this.resolveInputs(inputs, flow, execution, data, true)
            .stream()
            .filter(InputAndValue::enabled)
            .map(it -> {
                //TODO check to return all exception at-once.
                if (it.exceptions() != null && !it.exceptions().isEmpty()) {
                    throw  InputOutputValidationException.merge(it.exceptions());
                }
                return new AbstractMap.SimpleEntry<>(it.input().getId(), it.value());
            })
            .collect(HashMap::new, (m,v)-> m.put(v.getKey(), v.getValue()), HashMap::putAll);
        if (resolved.size() < data.size()) {
            RunContext runContext = runContextFactory.of(flow, execution);
            for (var inputKey : data.keySet()) {
                if (!resolved.containsKey(inputKey)) {
                    runContext.logger().warn(
                        "Input {} was provided for workflow {}.{} but isn't declared in the workflow inputs",
                        inputKey,
                        flow.getNamespace(),
                        flow.getId()
                    );
                }
            }
        }
        return MapUtils.flattenToNestedMap(resolved);
    }

    /**
     * Utility method for retrieving types inputs.
     *
     * @param inputs    The Flow's inputs
     * @param execution The Execution.
     * @param data      The Execution's inputs data.
     * @return The Map of typed inputs.