Repository navigation
fix(java): preserve Feign Jackson tagged oneOf variants - #25531
Open
AndreyVMarkelov wants to merge 2 commits into
Open
AndreyVMarkelov wants to merge 2 commits into
AndreyVMarkelov wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Preserve object
oneOfvariants in Java Feign/Jackson clients when the variants have a common required string property with distinct single-value enums. For an open variant, acceptnot: enumwhen it excludes exactly the known tag values.Generate a Jackson-polymorphic interface with subtype mappings and a fallback for the open variant. Closed unions reject unknown tags. This fixes loss of variants such as Dropbox
FilesMetadataduring deserialization.This is limited to tagged unions whose variants can be identified from the schema. It does not add general
oneOfvalidation or standalonenot: enumproperty validation. Related okhttp-gson validation work: #25066.Tests
JavaClientCodegenTest#testFeignJacksonTaggedOneOf.--library feign --additional-properties=serializationLibrary=jackson; verifiedFilesMetadatafile, folder and deleted variants andCommonRootInfoknown and fallback variants.The generated-client runtime fixture was copied into the generated client's test directory and run with Maven.
PR checklist
Summary by cubic
Preserves object
oneOfvariants in Java Feign/Jackson clients when variants share a required string tag with distinct single-value enums. Previously such variants were lost during deserialization; now they generate a Jackson-polymorphic interface with subtype mappings, a fallback for the open variant, and anInvalidVariantstub on closed unions that throws on unknown tags.Limited to tagged unions whose variants are identifiable from the schema. Does not add general
oneOfvalidation or standalonenot: enumproperty validation. Adds a CI workflow that generates a client from the new fixture and runs the runtime deserialization test.Tests
testFeignJacksonTaggedOneOfchecks the generated interface, subtype mappings, and fallback class.FilesMetadatafile, folder, and deleted variants andCommonRootInfofallback behavior.Written for commit fc2c99e. Summary will update on new commits.