[python] Add mock API tests for XML scenarios from PR #10063 and fix XML serialization bugs#10098
Conversation
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
commit: |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
…mespace fallback pattern Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/c063fa73-5d6e-4cbd-ae5b-c5a2d188abba
Extracted xml_ns = _get_xml_ns(prop_meta)
if xml_ns is None and not model_meta.get("prefix"):
xml_ns = _get_xml_ns(model_meta)The old-style
Done in 460cfdb — extracted |
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
|
@copilot fix the following CI error: |
…rialization Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/bacb0178-de28-436e-81a5-8ecd967cc74d Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
... Fixed in ab1635e. The mypy error was caused by |
Extract helper functions from Model.__init__ and _get_element to resolve too-many-branches, too-many-statements, and too-many-nested-blocks lint violations introduced by XML namespace handling improvements. Changes: - Extract _init_from_xml() from Model.__init__ (21->6 branches, 55->15 stmts) - Extract _set_xml_attribute() from _get_element (removes try/except nesting) - Add _resolve_xml_ns() consolidating 3-line ns resolution pattern (3 call sites) - Add _safe_register_namespace() standardizing ET.register_namespace error handling - Fix _get_xml_ns() docstring (add :param:, :returns:, :rtype:) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…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>
itemNs→itemsNskey mismatch in deserialization (red bug)orchains for namespace lookups withis Nonechecks (handles empty-string namespaces correctly)ET._namespace_mapsilent fallback behavior.venv_testfrom.gitignore(local dev leftover)_get_xml_nshelper to eliminate 9x duplicated ns/namespace fallback patternOptional[Any]type error in unwrapped array deserialization blockOriginal prompt
🔒 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.