Bug Report Checklist
Description
Kotlin client generator includes all params into parent and children if spec contains both oneOf and allOf.
Expected behaviour: parent interface contains only parent params, children overrides parent and includes their own
openapi-generator version
7.23.0
OpenAPI declaration file content or url
components:
schemas:
Pet:
description: A pet
type: object
discriminator:
propertyName: petType
mapping:
cat: '#/components/schemas/Cat'
dog: '#/components/schemas/Dog'
properties:
name:
type: string
required:
- name
- petType
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
Cat:
description: A pet cat
type: object
allOf:
- $ref: '#/components/schemas/Pet'
properties:
petType:
const: 'cat'
huntingSkill:
type: string
description: The measured skill for hunting
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
Dog:
description: A pet dog
type: object
allOf:
- $ref: '#/components/schemas/Pet'
properties:
petType:
const: 'dog'
packSize:
type: integer
format: int32
description: the size of the pack the dog is from
default: 0
minimum: 0
required:
- petType
- packSize
Generation Details
Default kotlin client generator with Jackson serialization
Steps to reproduce
generate kotlin client
Current output:
interface Pet {
@get:JsonProperty("name")
val name: kotlin.String
@get:JsonProperty("petType")
val petType: kotlin.Any?
/* the size of the pack the dog is from */
@get:JsonProperty("packSize")
val packSize: kotlin.Int
/* The measured skill for hunting */
@get:JsonProperty("huntingSkill")
val huntingSkill: Pet.HuntingSkill
/**
* The measured skill for hunting
*
* Values: clueless,lazy,adventurous,aggressive
*/
enum class HuntingSkill(val value: kotlin.String) {
@JsonProperty(value = "clueless") clueless("clueless"),
@JsonProperty(value = "lazy") lazy("lazy"),
@JsonProperty(value = "adventurous") adventurous("adventurous"),
@JsonProperty(value = "aggressive") aggressive("aggressive");
}
}
/// one of the children
data class Cat (
@param:JsonProperty("name")
@get:JsonProperty("name")
override val name: kotlin.String,
/* The measured skill for hunting */
@param:JsonProperty("huntingSkill")
@get:JsonProperty("huntingSkill")
val huntingSkill: Cat.HuntingSkill,
/* the size of the pack the dog is from */
@param:JsonProperty("packSize")
@get:JsonProperty("packSize")
override val packSize: kotlin.Int = 0,
@param:JsonProperty("petType")
@get:JsonProperty("petType")
val petType: kotlin.Any? = null
) : Pet {
Expected result:
interface Pet {
@get:JsonProperty("name")
val name: kotlin.String
}
// one of the children
data class Cat (
@param:JsonProperty("name")
@get:JsonProperty("name")
override val name: kotlin.String,
/* The measured skill for hunting */
@param:JsonProperty("huntingSkill")
@get:JsonProperty("huntingSkill")
val huntingSkill: Cat.HuntingSkill,
@param:JsonProperty("petType")
@get:JsonProperty("petType")
val petType: kotlin.Any? = null
) : Pet {
Related issues/PRs
Suggest a fix
#24163
Bug Report Checklist
Description
Kotlin client generator includes all params into parent and children if spec contains both oneOf and allOf.
Expected behaviour: parent interface contains only parent params, children overrides parent and includes their own
openapi-generator version
7.23.0
OpenAPI declaration file content or url
Generation Details
Default kotlin client generator with Jackson serialization
Steps to reproduce
generate kotlin client
Current output:
Expected result:
Related issues/PRs
Suggest a fix
#24163