<#3378 [flytekit-java] Reduce verbosity when defin...
# flyte-github
a
#3378 [flytekit-java] Reduce verbosity when defining types with one variable Issue created by narape Motivation: Why do you think this is important? If a developer wants to define a task equivalent to (String str) -> str.toUpperCase() currently he/she needs to write it in Java as
Copy code
@AutoService(SdkRunnableTask.class)
public class ToUpperCaseTask extends SdkRunnableTask<ToUpperCaseTask.Input, ToUpperCaseTask.Output> {
  public ToUpperCaseTask() {
    super(JacksonSdkType.of(Input.class), JacksonSdkType.of(Output.class));
  }

  @AutoValue
  public abstract static class Input {
    public abstract SdkBindingData<String> in();
  }

  @AutoValue
  public abstract static class Output {
    public abstract SdkBindingData<String> out();

    public static Output create(String out) {
      return new AutoValue_ToUpperCaseTask_Output(out);
    }
  }

  @Override
  public Output run(Input input) {
    return Output.create(SdkBindingDataFactory.of(input.get().toUpperCase()));
  }
}
For such trivial task, defining the AutoValues to define the types takes the majority of the lines, i.e. it is too verbose. It would be cool to have an alternative way to express the same in a simpler way Goal: What should the final outcome look like, ideally? I would like to have a way to define this simple types as one liner:
SdkTypes.of(SdkLiteralTypes.strings(), "str")
Describe alternatives you've considered I have considered code generation, but it has a cost and it is better to explore first alternatives without it Propose: Link/Inline OR Additional context No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte