backbase-openapi-tools icon indicating copy to clipboard operation
backbase-openapi-tools copied to clipboard

RFC: Remove Lombok.

Open jjjasper opened this issue 2 years ago • 2 comments

Using lombok in the generated sources does not make sense. Lombok value is to keep source code readable and compact by avoiding boiler-plate getters and setters. Generated code is not meant to be looked at, it is not aimed to be pretty and nobody cares if it is boiler-plate because nobody maintains it.

Adding lombok support complicates solutions (having to take into account both with and without lombok)

jjjasper avatar Sep 19 '23 13:09 jjjasper

@jjjasper I'm wondering.. maybe it would be easier to always use lombok in generated code? Looks like less code to maintain in mustache templates. Have a look at this code which is generated when not using lombok https://github.com/Backbase/backbase-openapi-tools/blob/92b2e8fe80578f80967a34df3e159c8741a7d6bb/boat-scaffold/src/main/templates/boat-spring/pojo.mustache#L315-L373 in comparison to lombok approach https://github.com/Backbase/backbase-openapi-tools/blob/92b2e8fe80578f80967a34df3e159c8741a7d6bb/boat-scaffold/src/main/templates/boat-spring/pojo.mustache#L27-L30

Maybe we need to do some more analysis which approach to choose (I'm definitely for keeping only one of them)

walaniam avatar Feb 21 '24 15:02 walaniam

@jjjasper And other thing that I spotted: Code generated with lombok:

  @lombok.Getter
  @lombok.Setter
  @lombok.EqualsAndHashCode.Include
  @lombok.ToString.Include

    @Valid
    @NotNull
    
    private List<@Valid PaymentRequestLine> lines = new ArrayList<>();

code generated without lombok

    @Valid
    @NotNull
    
    private List<@Valid PaymentRequestLine> lines = new ArrayList<>();

  /**
    * Payment request details
  * @return lines
  */
    @NotNull @Valid 
    @Schema(name = "lines", description = "Payment request details", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonProperty("lines")
  public List<@Valid PaymentRequestLine> getLines() {
  return lines;
  }

  public void setLines(List<@Valid PaymentRequestLine> lines) {
  this.lines = lines;
  }

The sample without lombok contains some additional annotations (e.g. JsonProperty, Schema). The one which uses lombok seems not to have these annotations.

walaniam avatar Feb 21 '24 15:02 walaniam