Repository navigation
Closed as not planned
Closed as not planned
Copy link
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?
- 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
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
- packSizeGeneration 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 {
Activity
bykakashka commentedon Jul 17, 2026
won't do because of the oneOf + anyOf is not officially supported by openapi spec