Add XML model test cases for enum and datetime properties#9660
Add XML model test cases for enum and datetime properties#9660
Conversation
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
|
@copilot - This is great. Can you use the same process to add an additional test case to this PR, this time testing a model with datetime properties. It should test both "rfc3339" and "rfc7231" formatted datetime objects. |
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Added test case for XML model with datetime properties testing both rfc3339 and rfc7231 encodings in commit 22986dc. The new
Both GET and PUT operations are supported at endpoint Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
commit: |
|
You can try these changes here
|
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
.chronus/changes/copilot-add-xml-datetime-test-2026-02-11-19-21-36.md
Outdated
Show resolved
Hide resolved
.chronus/changes/copilot-add-xml-enum-test-2026-02-09-22-43-28.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
… API tests (#9724) - [x] Ensure prerequisites are met (pnpm install, package build) - [x] Identify the Spector case link (from PR #9660: `payload/xml` ModelWithEnum and ModelWithDatetime) - [x] Update `@typespec/http-specs` dependency to `0.1.0-alpha.33-dev.2` in `packages/http-client-python/package.json` - [x] Regenerate the `payload/xml` generated client - [x] Fix XML deserialization bug for enum (CaseInsensitiveEnumMeta) and datetime types in `model_base.py.jinja2` - [x] Add None check for `value.text` before passing to `_DESERIALIZE_MAPPING` / `_DESERIALIZE_MAPPING_WITHFORMAT` callables - [x] Implement sync tests in `generic_mock_api_tests/test_payload_xml.py` for ModelWithEnum and ModelWithDatetime - [x] Implement async tests in `generic_mock_api_tests/asynctests/test_payload_xml_async.py` for ModelWithEnum and ModelWithDatetime - [x] Format changed Python files with Black - [x] Validate tests locally (all 15 sync + 15 async tests pass) - [x] Add a changelog entry under `.chronus/changes` - [x] Run code review (no issues found) - [x] Run CodeQL security scan (no alerts) ## Security Summary No security vulnerabilities were introduced or discovered. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- 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: annatisch <8689453+annatisch@users.noreply.github.com>
Adds test coverage for XML payloads containing models with enum and datetime properties to
packages/http-specs/specs/payload/xml.Changes
ModelWithEnum
ModelWithEnumwith singlestatusproperty of extensible union typeStatusunion with "pending", "success", "error" variants/payload/xml/modelWithEnumExample payload:
The extensible union allows any string value beyond the defined variants, following TypeSpec's standard enum pattern.
ModelWithDatetime
ModelWithDatetimewith datetime properties using different encodingsrfc3339with@encode(DateTimeKnownEncoding.rfc3339)decoratorrfc7231with@encode(DateTimeKnownEncoding.rfc7231)decorator/payload/xml/modelWithDatetimeExample payload:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.