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

Regression: useBeanValidation broken from #633

Closed
jjjasper opened this issue Sep 11, 2023 · 2 comments
Closed

Regression: useBeanValidation broken from #633

jjjasper opened this issue Sep 11, 2023 · 2 comments
Assignees

Comments

@jjjasper
Copy link
Contributor

jjjasper commented Sep 11, 2023

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

@walaniam
Copy link
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

@jjjasper
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants