Skip to content

Do not wrap array attributes in a new array on User.merge - #755

Open
jnbdz wants to merge 1 commit into
eclipse-vertx:masterfrom
SiteNetSoft:issue-550-user-merge-array
Open

Do not wrap array attributes in a new array on User.merge#755
jnbdz wants to merge 1 commit into
eclipse-vertx:masterfrom
SiteNetSoft:issue-550-user-merge-array

Conversation

@jnbdz

@jnbdz jnbdz commented Aug 8, 2026

Copy link
Copy Markdown

When merging two User objects where only the merged-in user has an array attribute for a given key, User.merge wrapped that array in a new array: roles = ["write"] became roles = [["write"]].

The accumulate logic in UserImpl.merge handled every combination correctly (array+array concatenates, scalar+scalar becomes a two-element array, ...) except the case where the current user has no value for the key and the other user's value is an array — that branch added the whole array as a single element. This change keeps a copy of the other user's array instead, consistent with the copy the method already makes when the whole attributes object is absent.

Added coverage to UserTest for array attributes present on only one side of the merge (both directions).

Fixes #550

When merging two users where only the other user has an array attribute
for a given key, the attribute ended up as an array nested inside a new
array, e.g. roles ["write"] became [["write"]]. Keep a copy of the
other user array instead, consistent with how the remaining accumulate
cases behave.

Fixes eclipse-vertx#550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User.merge puts array attribute in array

1 participant