opensearch-project / opensearch-project/flow-framework
[REFACTOR] Eliminate duplication of required input / output List/Set
@kokibas is already working on this.
Since Jan 12, 2026.
- Dominant language
- Java
- Stars
- 62
- Forks
- 66
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 20
Description
Is your feature request related to a problem?
The WorkflowValidatorTests class contains a lot of repetitive code that could be refactored to be more general.
This test class was originally written to validate the JSON file. Following #523 we now have an Enum and easier access to programmatically perform these tests, so it can be simplified.
What solution would you like?
The manual creation of a map here can be reduced to a single statement, which I've done as part of #530 .
The Input/Output size checks here could be improved.
Taking one entry as an example:
assertTrue(validator.getWorkflowStepValidators().keySet().contains("create_connector"));
assertEquals(7, validator.getWorkflowStepValidators().get("create_connector").getInputs().size());
assertEquals(1, validator.getWorkflowStepValidators().get("create_connector").getOutputs().size());
- The repeated string "create_connector" corresponds to the class name and should be replaced by
CreateConnectorStep.NAME. - There's no need to check the presence of the key in the keyset, the next line will throw an NPE when
get()returns null and we try to get inputs or outputs. - We should refactor to avoid duplication of the required inputs. Currently each workflow step defines its required inputs inline in the code (as a
Set<String>) and separately in theWorkflowStepValidatorclass (as aList<String>). This duplication should be removed by making the collection a class field with a getter similarly to howNAMEis declared. - We don't currently define the outputs in the
WorkflowStepimplementation classes, but we should do so to keep that declaration closer to where we actually populate theWorkflowDatawhen the step is complete.
What alternatives have you considered?
Leave the code as-is and keep adding to it.
Do you have any additional context?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.