(bugfix) Quick xml defaultable choice with single option#262
Open
c-norm wants to merge 3 commits intoBergmann89:masterfrom
Open
(bugfix) Quick xml defaultable choice with single option#262c-norm wants to merge 3 commits intoBergmann89:masterfrom
c-norm wants to merge 3 commits intoBergmann89:masterfrom
Conversation
Bergmann89
requested changes
Mar 30, 2026
Author
|
Wow that took a lot longer than I thought it would. I think all defaultable sequences were borked. I added a test case for an
|
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.
There's a bug when using the
quick_xmldeserialization feature when determining what isDefaultablewhen you have anxs:choicewith a single element in it.Right now, when making the
DefaultableCache, if you have aMetaTypeVariant::Choicewith a single element in it, and that element is anElementMode::Groupthen it assumes theChoiceisDefaultable. But this isn't true, the single element inside theChoicemust also beDefaultable.I encountered this bug working with a schema called genericode. In it, there's type that basically boils down to an
xs:choicewith a singlexs:sequencethat has anxs:elementin it.Attached is a minimum schema to cause the issue:
choice-with-sequence.xml (github wouldn't let me attach an xsd?)
This breaks, because when deserializing the content of the Document, if it encounters nothing then it tries to make the enum that represents choice with the single value and then tries to construct a default value for the sequence, but the sequence does not implement
Default.My bug fix just checks if the type inside the
Choiceis itself defaultable. This worked for my use case and all the tests still passed locally