Skip to content

Add missing scenarios for xml handling#10063

Merged
timotheeguerin merged 4 commits into
microsoft:mainfrom
timotheeguerin:http-specs-xml-gaps
Mar 18, 2026
Merged

Add missing scenarios for xml handling#10063
timotheeguerin merged 4 commits into
microsoft:mainfrom
timotheeguerin:http-specs-xml-gaps

Conversation

@timotheeguerin
Copy link
Copy Markdown
Member

And reorganize/add mapping to the guide

@microsoft-github-policy-service microsoft-github-policy-service Bot added the lib:http-specs For issues/prs related to the @typespec/http-specs package label Mar 17, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 17, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-specs@10063

commit: 53f915b

Comment thread packages/http-specs/specs/payload/xml/main.tsp
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2026

All changed packages have been documented.

  • @typespec/http-specs
Show changes

@typespec/http-specs - feature ✏️

Add missing scenarios for xml handling

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Expands the payload/xml HTTP specs to cover additional XML serialization scenarios (renaming, nested models, array wrapping/unwrapping variants, attributes, and namespaces) and wires them into the mock server so Spector scenarios can be executed end-to-end.

Changes:

  • Added new XML payload fixtures and scenario handlers in the mock API for additional XML shapes.
  • Extended the TypeSpec spec with new models and scenario interfaces covering renaming, nesting, array wrapping/unwrapping, attributes, and namespaces.
  • Refactored model documentation from @doc(...) decorators to TypeSpec doc comments (/** ... */) and regrouped shared types.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/http-specs/specs/payload/xml/mockapi.ts Adds XML example strings and registers corresponding GET/PUT mock scenario handlers for the new routes.
packages/http-specs/specs/payload/xml/main.tsp Adds new XML models + scenario interfaces (routes) to exercise additional XML mapping behaviors, including namespaces and renamed elements/attributes.

You can also share your feedback on Copilot code review. Take the survey.

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Mar 17, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin timotheeguerin added this pull request to the merge queue Mar 18, 2026
Merged via the queue into microsoft:main with commit a101c95 Mar 18, 2026
29 of 30 checks passed
@timotheeguerin timotheeguerin deleted the http-specs-xml-gaps branch March 18, 2026 22:59
Copilot AI added a commit that referenced this pull request Mar 19, 2026
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
github-merge-queue Bot pushed a commit that referenced this pull request Mar 31, 2026
…XML serialization bugs (#10098)

- [x] Bump @typespec/http-specs to 0.1.0-alpha.35
- [x] Add 11 new XML scenario tests (sync + async)
- [x] Fix unwrapped model array element naming
- [x] Fix namespace key mismatch (DPG "namespace" vs runtime "ns")
- [x] Fix default-namespace propagation semantics
- [x] Fix Python ET reserved prefix (ns\d+)
- [x] Remove all 4 @pytest.mark.skip markers — 26/26 tests pass
- [x] Update changelog entry to reflect generator fixes and all-green
tests
- [x] Fix `itemNs` → `itemsNs` key mismatch in deserialization (red bug)
- [x] Replace all `or` chains for namespace lookups with `is None`
checks (handles empty-string namespaces correctly)
- [x] Add note about `ET._namespace_map` silent fallback behavior
- [x] Remove `.venv_test` from `.gitignore` (local dev leftover)
- [x] Extract `_get_xml_ns` helper to eliminate 9x duplicated
ns/namespace fallback pattern
- [x] Merge main branch, resolve conflicts using main's dependency
versions
- [x] Fix mypy `Optional[Any]` type error in unwrapped array
deserialization block

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>[python] add test case for
#10063
> </issue_title>
> <issue_description>follow skill
https://github.com/microsoft/typespec/blob/main/.github/skills/python-sdk-spector-mock-api-tests/SKILL.md
to write test case for #10063
> </issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #10097

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: iscai-msft <isabellavcai@gmail.com>
msyyc added a commit that referenced this pull request Apr 1, 2026
…XML serialization bugs (#10098)

- [x] Bump @typespec/http-specs to 0.1.0-alpha.35
- [x] Add 11 new XML scenario tests (sync + async)
- [x] Fix unwrapped model array element naming
- [x] Fix namespace key mismatch (DPG "namespace" vs runtime "ns")
- [x] Fix default-namespace propagation semantics
- [x] Fix Python ET reserved prefix (ns\d+)
- [x] Remove all 4 @pytest.mark.skip markers — 26/26 tests pass
- [x] Update changelog entry to reflect generator fixes and all-green
tests
- [x] Fix `itemNs` → `itemsNs` key mismatch in deserialization (red bug)
- [x] Replace all `or` chains for namespace lookups with `is None`
checks (handles empty-string namespaces correctly)
- [x] Add note about `ET._namespace_map` silent fallback behavior
- [x] Remove `.venv_test` from `.gitignore` (local dev leftover)
- [x] Extract `_get_xml_ns` helper to eliminate 9x duplicated
ns/namespace fallback pattern
- [x] Merge main branch, resolve conflicts using main's dependency
versions
- [x] Fix mypy `Optional[Any]` type error in unwrapped array
deserialization block

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>[python] add test case for
#10063
> </issue_title>
> <issue_description>follow skill
https://github.com/microsoft/typespec/blob/main/.github/skills/python-sdk-spector-mock-api-tests/SKILL.md
to write test case for #10063
> </issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #10097

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: iscai-msft <isabellavcai@gmail.com>
github-merge-queue Bot pushed a commit to Azure/typespec-azure that referenced this pull request Apr 1, 2026
## Summary

Categorizes 78 test scenarios as **Backlog** in the Can I Use dashboard
based on cross-language analysis of skipped tests across Go, Java,
Python, and JS emitters.

**Criterion**: A scenario is moved to Backlog if it is skipped by **2 or
more** of the 4 major language emitters, indicating the feature is
optional rather than a single-emitter gap. Newly added scenarios that
fit an existing Backlog category are also included.

### Data Sources
| Language | Source |
|----------|--------|
| Go | [autorest.go#1812
comment](Azure/autorest.go#1812 (comment))
|
| Python |
[autorest.python#3372](Azure/autorest.python#3372)
|
| Java | \java-skipped.txt\ in repo root |
| JS | \js-skipped.txt\ in repo root |

### Scenarios Added to Backlog (78 tests, skipped by 2+ languages)

| Category | Tests | Languages Skipping |
|----------|-------|--------------------|
| Routes Path/Query Parameter Expansion | 32 | Go, Java, Python |
| Type Union Discriminated | 8 | Go, Java, Python |
| Pageable ContinuationToken | 6 | Go, Java, JS |
| Pageable AlternateInitialVerb | 1 | New
([microsoft/typespec#9966](microsoft/typespec#9966));
no language implemented yet |
| Azure AlternateType ExternalType | 4 | Go, Python, JS |
| Azure ClientDefaultValue | 4 | Go, Java |
| Authentication Noauth Union | 2 | Go, JS |
| Pageable Link-based pagination | 3 | Java, JS |
| Pageable PageSize | 2 | Java, JS |
| Pageable XmlPagination | 2 | Go, Java |
| Response StatusCodeRange | 2 | Go, JS |
| Type File Body | 8 | Python, JS |
| Encode Duration float*LargerUnit | 4 | Python, JS |
| **Total** | **78** | |

### New XML scenarios kept as Core

22 new XML scenarios from
[microsoft/typespec#10063](microsoft/typespec#10063)
remain **Core**. Existing \Payload_Xml_*\ tests are only skipped by Java
(1 language) — Go, Python, and JS pass them — so XML is an
emitter-specific gap, not an optional feature.

---

### Scenarios Remaining in Core (~147 skipped tests kept as Core)

Tests skipped by only 1 language remain Core — 3 of 4 emitters already
support them, so these are emitter-specific gaps, not optional features.

#### Go-only skips (~86 tests) — mostly blocked on union support

| Category | Count | Reason |
|----------|-------|--------|
| Type_Union (non-discriminated) | 20 | Requires union support |
| Type_Property_AdditionalProperties (union-related) | 34 | Requires
union support |
| Encode_Array | 12 | Tracked in
[autorest.go#1771](Azure/autorest.go#1771) |
| Type_Model_Inheritance_NestedDiscriminator | 6 | Not a real scenario —
will fix on demand |
| Versioning (Added/Removed/RenamedFrom) | 9 | Requires union support |
| Authentication_Union | 2 | Requires union support |
| SpecialHeaders_Repeatability | 1 | Requires union support |
| DeserializeEmptyStringAsNull | 1 | Tracked in
[autorest.go#1857](Azure/autorest.go#1857) |
| Azure_Core_Page_withParameterizedNextLink | 1 | Tracked in
[autorest.go#1576](Azure/autorest.go#1576) |

> Go's gaps are primarily due to missing union support. Once Go adds
unions, ~66 of these tests will pass.

#### Python-only skips (~33 tests) — feature-specific gaps

| Category | Count | Reason |
|----------|-------|--------|
| Encode_Duration (int/non-float variants) | 20 | No urgent demand for
these encodings |
| ClientInitialization (Individually*) | 13 | Feature not yet needed by
Python |

> Java, Go, and JS support these. Python's gaps are implementation
priorities, not optional features.

#### Java-only skips (~28 tests) — XML and misc

| Category | Count | Reason |
|----------|-------|--------|
| Payload_Xml | 26 | XML support incomplete |
| Parameters_Path_optional | 1 | Not yet implemented |
| Resiliency_ServiceDriven_breakTheGlass | 1 | Not yet implemented |

> Go, Python, and JS support these. XML is a real Azure feature used by
services like Storage.

#### JS-only skips (0 tests)

All JS-skipped tests overlapped with at least one other language, so
they all moved to Backlog.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:http-specs For issues/prs related to the @typespec/http-specs package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants