Preserve reference order in generated XML encoders - #53
Merged
Conversation
Collaborator
|
Hi @rallep71, many thanks for your contribution! In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. |
This was referenced Aug 24, 2026
rallep71
force-pushed
the
fix/preserve-reference-order
branch
from
August 27, 2026 11:45
e0fca27 to
5e5e10f
Compare
Collaborator
|
You did it @rallep71! Thank you for signing the ProcessOne Contribution License Agreement. We will have a look at your contribution! |
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.
While testing SASL2, I found that generated encoders can emit groups of child
elements in a different order from the one declared in the codec
specification.
group_refs/1currently stores the groups in adictand returns them withdict:to_list/1. That does not preserve their order in#elem.refs. Theencoder then builds an accumulator which is reversed before output, so the
resulting sibling order depends on the dictionary ordering.
This change records the first occurrence of each group while keeping the
existing grouping behaviour. It also folds the groups in the direction needed
by the final accumulator reversal.
The XML-RPC codec has been regenerated, and the regression test uses a small
codec with two
mechanismchildren followed byinline. Before the fix it isserialised as
inline, mechanism, mechanism; with the fix the declared orderis retained.
Related to processone/ejabberd#4606.
Tests
rebar3 eunit -v— 86 tests passed on Erlang/OTP 28rebar3 xrefREBAR=rebar3 make spec