flow-framework icon indicating copy to clipboard operation
flow-framework copied to clipboard

[REFACTOR] Make WorkflowState more easily updated with a Builder Constructor from a previous state

Open dbwiddis opened this issue 1 year ago • 0 comments

Is your feature request related to a problem?

Making one change on a WorkflowState object requires re-adding all the individual fields through the builder. See for example: https://github.com/opensearch-project/flow-framework/blob/e3a878405848613ed0ed6166bec281bcbdb97346/src/main/java/org/opensearch/flowframework/transport/GetWorkflowStateResponse.java#L51-L55

What solution would you like?

Create a constructor on the Builder that accepts a previous state as its input and copies over the fields. Then only the changed fields need to be added. We do this for the Template class here.

What alternatives have you considered?

Leaving it as-is.

Do you have any additional context?

I actually did the work for this in my POC PR #631 so someone just needs to copy-paste some of those changes. :-)

dbwiddis avatar May 08 '24 00:05 dbwiddis