Skip to content

Fix XML object serializer missing itemsName wrapping for arrays#3774

Merged
joheredi merged 1 commit intoAzure:mainfrom
joheredi:joheredi/fix-xml-array-items-name-wrapping
Feb 19, 2026
Merged

Fix XML object serializer missing itemsName wrapping for arrays#3774
joheredi merged 1 commit intoAzure:mainfrom
joheredi:joheredi/fix-xml-array-items-name-wrapping

Conversation

@joheredi
Copy link
Copy Markdown
Member

Problem

The buildXmlObjectModelSerializer (used for nested models) was generating flat mappings for array properties
without wrapping items under their itemsName element. This caused incorrect XML where array items were placed
directly under the wrapper element, missing the intermediate item element.

For example, given:

model ArrowConfiguration {
  @Xml.name("Schema") schema: ArrowField[];
}

@Xml.name("Field")
model ArrowField { ... }

Before (incorrect): { "Schema": items.map(...) } After (correct): { "Schema": { "Field": items.map(...) } }
Fix

Modified buildXmlObjectPropertyAssignments in buildXmlSerializerFunction.ts to read xmlOptions.itemsName and
xmlOptions.unwrapped for array properties and generate the correct nested structure.

Testing

  • Added scenario tests for wrapped and unwrapped arrays with model items (10 tests)
  • All 509 unit tests pass
  • All 878 azure-modular integration tests pass

Fixes #3771

The buildXmlObjectPropertyAssignments function was generating flat mappings
for array properties without wrapping items under their itemsName element.
This caused incorrect XML where array items were placed directly under the
wrapper element, missing the intermediate item element (e.g., <Field>).

For wrapped arrays, now generates: { "WrapperName": { "ItemsName": items } }
For unwrapped arrays, now generates: { "ItemsName": items }

Fixes Azure#3771

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joheredi joheredi merged commit 446cb00 into Azure:main Feb 19, 2026
16 checks passed
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.

XML: storage query serialization issue

2 participants