-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Given this configuration of the openapi-generator-maven-plugin:
<configuration>
<inputSpec>
${project.basedir}/src/main/resources/openapi/api.yaml
</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>org.openapitools.codegen.api</apiPackage>
<modelPackage>org.openapitools.codegen.api.model</modelPackage>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<apiPackage>org.openapitools.codegen.controller</apiPackage>
<serializableModel>true</serializableModel>
<documentationProvider>springdoc</documentationProvider>
<additionalModelTypeAnnotations>@lombok.Builder @lombok.NoArgsConstructor @lombok.AllArgsConstructor</additionalModelTypeAnnotations>
</configOptions>
</configuration>
And given a component schema like the following:
components:
schemas:
PatchRequest:
type: array
items:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
- $ref: '#/components/schemas/C'
A:
type: object
...
B:
type: object
...
C:
type: object
...
The generator generates a Java interface annotated with Lombok annotations:
lombok.Builder @lombok.NoArgsConstructor @lombok.AllArgsConstructor
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2022-11-04T13:47:46.119673+01:00[Europe/Berlin]")
public interface PatchRequestInner extends Serializable {
}
Which makes the compilation to fail.
Please, look at this repository to reproduce the bug: https://github.com/luciano-fiandesio/openapi-generator-plugin-bug
openapi-generator version
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.2.1</version>
OpenAPI declaration file content or url
Generation Details
Incorrectly annotated Interface:
lombok.Builder @lombok.NoArgsConstructor @lombok.AllArgsConstructor
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2022-11-04T13:47:46.119673+01:00[Europe/Berlin]")
public interface PatchRequestInner extends Serializable {
}
Steps to reproduce
Please see this repository: https://github.com/luciano-fiandesio/openapi-generator-plugin-bug
Reactions are currently unavailable