-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Add support for oneOf with discriminator when using kotlinx.serialization #22373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for oneOf with discriminator when using kotlinx.serialization #22373
Conversation
| @@ -0,0 +1,12 @@ | |||
| generatorName: kotlin | |||
| outputDir: samples/client/others/kotlin-oneOf-discriminator-kotlinx-serialization | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the new folder to the gihtub workflow so that it will be tested moving forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I see, thank you! Updated the workflow!
|
Hmmm not sure how can I rerun the build, seems like it failed for unrelated reasons, given that it was green for previous commit, and I've only updated the yaml |
|
Ah I think that's CloudFlare being down: https://www.cloudflarestatus.com/ |
|
restarted failed jobs and all passed |
|
thanks for the contribution, which has been merged |
|
Thank you so much for a quick review! |
…tion (OpenAPITools#22373) * Generate wrappers for oneOf with discriminator when using kotlinx.serialization * Add spec with oneOf using discriminator * Add config to generate samples * Generate samples * Update samples * Change naming of wrapper classes * Fix empty model test * Update GH workflow with new samples
This PR adds support for
oneOfwith discriminator when usingkotlinx.serializationlibrary.Approach taken does tagged union emulation by adding value classes wrapping the original entities.
The spec included for testing attempts to cover tricky use cases with
oneOf:PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)/cc @karismann @Zomzog @andrewemery @4brunu @yutaka0m @stefankoppier @e5l as technical committee