Skip to content

Regression: useBeanValidation broken from  #633

Closed

Description

@jjjasper

bean validations are no longer generated on Pojo's starting 0.17.5

generator: boat-spring

having open-api property definition

  state:
    maxLength: 50
    minLength: 1
    type: string

0.17.4 generates

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

      @NotNull @Size(min = 1, max = 50) 
      private String externalStateId;

0.17.5 generates

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

      private String externalStateId;

0.17.16 is still broken

Activity

  1. self-assigned this
    on Sep 11, 2023
  2. walaniam commented on Sep 14, 2023

    @walaniam
    Contributor

    @jjjasper I've noticed that those contstraints are added on getters.

    For such definition https://github.com/Backbase/backbase-openapi-tools/blob/main/boat-scaffold/src/test/resources/boat-spring/openapi.yaml#L201 there is following code being generated:

        @NotNull @Size(min = 3, max = 251) 
        @Schema(name = "name", description = "Request name", requiredMode = Schema.RequiredMode.REQUIRED)
        @JsonProperty("name")
      public String getName() {
      return name;
      }

    Above code is tested here (with real validator) https://github.com/Backbase/backbase-openapi-tools/blob/main/boat-scaffold/src/test/java/com/backbase/oss/codegen/java/BoatSpringCodeGenTests.java#L219

  3. jjjasper commented on Sep 14, 2023

    @jjjasper
    CollaboratorAuthor

    If the annotations were generated on the getters, that did not work for me in a real service.
    This change fixes the behaviour for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions