opensearch-project / opensearch-project/flow-framework

[REFACTOR] Eliminate duplication of required input / output List/Set

Open
#535 10 comments 0 reactions 1 assignee View on GitHub

@kokibas is already working on this.

Since Jan 12, 2026.

good first issue
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());
  1. The repeated string "create_connector" corresponds to the class name and should be replaced by CreateConnectorStep.NAME.
  2. 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.
  3. 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 the WorkflowStepValidator class (as a List<String>). This duplication should be removed by making the collection a class field with a getter similarly to how NAME is declared.
  4. We don't currently define the outputs in the WorkflowStep implementation classes, but we should do so to keep that declaration closer to where we actually populate the WorkflowData when 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?

https://en.wikipedia.org/wiki/Don%27t_repeat_yourself

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.