Skip to content

[BUG][JAVA][SPRING] When using lombok generators and generatedConstructorWithRequiredArgs build fails #16250

@dpozinen

Description

@dpozinen
Description

we use the spring generator with the below config

<openapi.producer.generator.config.additionalModelTypeAnnotations.default>
    @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
    @lombok.Builder(toBuilder = true)
    @lombok.NoArgsConstructor
    @lombok.AllArgsConstructor
</openapi.producer.generator.config.additionalModelTypeAnnotations.default>

to generate constructors & builders.

WIth the new generatedConstructorWithRequiredArgs parameter the build fails because lombok has already generated the constructor. Then the generator attempts to do the same and fails with a constructor already exists error.

openapi-generator version

6.6.0

Suggest a fix

I think it would be best to identify already generated constructors and just ignore them, instead of failing, since ultimately there already is a suitable constructor and hence the goal is achieved.

Not Duplicate

please note I am aware of #15494 and we have applied this workaround, but in my opinion this should work out of the box. Users shouldn't have to configure another property to work around this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions