Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Move workflow-steps.json to a Java class/enum #395

Closed
amitgalitz opened this issue Jan 10, 2024 · 1 comment · Fixed by #523
Closed

[FEATURE] Move workflow-steps.json to a Java class/enum #395

amitgalitz opened this issue Jan 10, 2024 · 1 comment · Fixed by #523
Assignees
Labels
enhancement New feature or request v2.13.0 Issues targeting release v2.13.0

Comments

@amitgalitz
Copy link
Member

Is your feature request related to a problem?

Currently we store lots of information regarding the workflow steps in a json file, we parse this json file for validation and other use cases. We also will soon add a new API that fetches the information in this json file. Because this json file is parsed in runtime, we can't use any of the information here during compile time to help our code be more stable.

What solution would you like?

We should store the information in either an Enum or a class. Some of the benefits are:

  1. Type safe with predefined constants
  2. compile time checking, reducing potential runtime errors and overhead for test cases
  3. less processing time spent on parsing json

For example the code could look something like this:

  CREATE_CONNECTOR(
        "create_connector",
        Arrays.asList("name ", "description", "version", "protocol", "parameters", "credential", "actions"),
        Arrays.asList("connector_id"),
        "connector_id"
    ),

    REGISTER_REMOTE_MODEL(
        "register_remote_model",
        Arrays.asList("name ", "function_name", "connector_id"),
        Arrays.asList("model_id", "register_model_status"),
                "model_id"
                );
...

    WorkflowStepsDefinition(String workflowStep, List<String> inputs, List<String> outputs, @Nullable String resourceCreated) {
        this.workflowStep = workflowStep;
        this.inputs = List.copyOf(inputs);
        this.outputs = List.copyOf(outputs);
        this.resourceCreated = resourceCreated;
    }
    
@dbwiddis
Copy link
Member

If we make it an enum we should integrate it with the workflow step factory so there's one place for people to add new capability. New enum value, along with the different components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v2.13.0 Issues targeting release v2.13.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants