Kotlinx polymorphism with custom discriminator support (#21531)

* kotlinx serialization fixes

- added new config with kotlinx, discriminator (/w custom name) and
  kotlinx_serialization
- remove discriminator properties from the generator in both base and
  derived classes
- set discriminatorValue in additionalProperties of derived classes
- add JsonClassDiscriminator the derived classes in the template
- set SerialName to discriminatorValue in the template
- change base classes to sealed class instead of interface
- make variables in base classes abstract

* Generated kotlin-allOff-discriminator-kotlinx-serialization sample

* Added test for kotlinx_serialization with discriminator

* renamed yaml

* Added new sample to github workflow

* Added comments to KotlinClientCodegen::postProcessAllModels
This commit is contained in:
some00
2025-07-31 10:29:39 +02:00
committed by GitHub
parent d7a8aae6e2
commit dba7aee41e
49 changed files with 1952 additions and 4 deletions

View File

@@ -66,6 +66,7 @@ jobs:
- samples/client/petstore/kotlin-name-parameter-mappings
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
- samples/client/others/kotlin-jvm-okhttp-path-comments
- samples/client/petstore/kotlin-allOff-discriminator-kotlinx-serialization
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4