You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue seems to occur in the java generator start in version 5.0.0, and still occurs in the latest version 6.1.0.
When using the discriminator pattern as described in the documentation, we no longer receive an interface object for the base class, but a class that contains all of the properties of all the OneOf objects.
In the old version of the generator (4.3.1) an interface is generated, which is implemented by the classes generated by the oneOf's.
I have omitted the generated annotations, since the problem lies in the java objects being generated.
This still worked in version 4.3.1
it broke in version 5.0.0
it still fails in 6.1.0
OpenAPI declaration file content or url
openapi: "3.0.3"info:
title: MS Pet APIversion: 1.0.0description: De API for testing the discriminator in openapi 6paths:
/api/projects:
get:
summary: get a petoperationId: getPetstags:
- petsresponses:
200:
description: Succes responscontent:
application/json:
schema:
type: arrayitems:
$ref: '#/components/schemas/PetResponse'components:
schemas:
PetResponse:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
- $ref: '#/components/schemas/Lizard'discriminator:
propertyName: petTypeCat:
type: object# all other properties specific to a `Cat`required:
- petTypeproperties:
catName:
type: stringpetType:
type: stringDog:
type: object# all other properties specific to a `Dog`required:
- petTypeproperties:
bark:
type: stringpetType:
type: stringLizard:
type: object# all other properties specific to a `Lizard`required:
- petTypeproperties:
lovesRocks:
type: booleanpetType:
type: string
Generation Details
We use the java generator, with both the WebClient and RestTemplate libraries. We also use the spring generator, but the interface is generated correctly there, so the problem seems to lie in the java generator.
I also run into that issue.
Looking at the code I'm not quite sure what to do. Just enable property parsing (#13490) or enable the feature by default?!
Description
The issue seems to occur in the java generator start in version 5.0.0, and still occurs in the latest version 6.1.0.
When using the discriminator pattern as described in the documentation, we no longer receive an interface object for the base class, but a class that contains all of the properties of all the OneOf objects.
In the old version of the generator (4.3.1) an interface is generated, which is implemented by the classes generated by the oneOf's.
I have omitted the generated annotations, since the problem lies in the java objects being generated.
4.3.1 situation
5.0.0 and on (6.1.0 still occurs)
openapi-generator version
This still worked in version 4.3.1
it broke in version 5.0.0
it still fails in 6.1.0
OpenAPI declaration file content or url
Generation Details
We use the java generator, with both the WebClient and RestTemplate libraries. We also use the spring generator, but the interface is generated correctly there, so the problem seems to lie in the java generator.
Steps to reproduce
clone the minimal reproduction repo:
https://github.com/FinKingma/specUsingDiscriminator/blob/main/spec.yaml
run ./gradlew openApiGenerate
Related issues/PRs
#8495
The text was updated successfully, but these errors were encountered: