[Spring] Bug incorrect response entity object when generating oneOf
Description
Incorrect response entity object when generating oneOf. Codegen generated an model interface, called OneOfinlineResponse200. 3 other classes extended OneOfinlineResponse200, including InlineResponse200, Token, Error
However, Codegen generated an api interface, called AuthenticationApi Inside this class, there is a function , ResponseEntity<InlineResponse200>login
When implementing AuthenticationApi interface, I can only response InlineResponse200, but not Token or Error...
Swagger-codegen version
Swagger declaration file content or url
paths:
/authentication:
post:
summary: Authenticate an user
operationId: login
requestBody:
description: Authenticate an user
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
200:
description: 'AAB'
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Error'
- $ref: '#/components/schemas/Token'
components:
schemas:
Error:
type: object
required:
- message
- code
properties:
message:
type: string
code:
type: string
User:
type: object
properties:
userName:
type: string
userPassword:
type: string
format: password
Token:
type: object
properties:
token:
type: string
Command line used for generation
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.23</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>
xxxxxx/openapi.yml
</inputSpec>
<language>spring</language>
<apiPackage>xxxx</apiPackage>
<modelPackage>xxxxx</modelPackage>
<supportingFilesToGenerate>
ApiUtil.java
</supportingFilesToGenerate>
<configOptions>
<sourceFolder>src/main/java/</sourceFolder>
<delegatePattern>true</delegatePattern>
<interfaceOnly>true</interfaceOnly>
<java8>true</java8>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
mvn clean compile
Related issues/PRs
Not found
Suggest a fix/enhancement
Should the function change from ResponseEntity<InlineResponse200> to ResponseEntity<OneOfinlineResponse200>
Or
InlineReponses200 class should have Token and User two variable?
Or
Just I don't know how to implement?