Repository navigation
Fix Python sample literals for quoted If-Match ETags - #12499
Yuchao Yan (msyyc) with Copilot wants to merge 5 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
|
Hi @Copilot. Your PR has had no update for 14 days and it is marked as a stale PR. If it is not updated within 14 additional days, the PR will automatically be closed. The |
|
Copilot resolve the merge conflicts in this pull request |
| @staticmethod | ||
| def handle_param(param: Union[Parameter, BodyParameter], param_value: Any) -> str: | ||
| if isinstance(param_value, str): | ||
| if any(i in param_value for i in '\r\n"'): |
There was a problem hiding this comment.
Check commit history to analyze why the logic was added. If there is reason to add it, we need be careful to delete it. Copilot
There was a problem hiding this comment.
Triple quoting originated in autorest.python#1546 to handle multiline runbook content with quotes. Type-level repr preserves that content, including CRLFs, without the delimiter/escaping problems. Added complete-sample regression coverage in 38092bc; all 343 string-literal tests pass.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change fixing quoted If-Match literals in Python samples.
No open issues 🎉
What changed in this PR
Fixes invalid Python sample literals for quoted If-Match ETags, addressing #12498 while preserving the exact header value.
Changes:
- Removes unsafe triple-quoting and delegates sample values to the existing type-level serializer.
- Adds regression tests for string-value preservation, Black formatting, and required
If-Matcharguments in complete samples. - Adds a Python emitter bug-fix changelog entry.
| File | Description |
|---|---|
packages/http-client-python/tests/unit/test_string_literals.py |
Adds literal and complete-sample regression coverage. |
packages/http-client-python/generator/pygen/codegen/serializers/sample_serializer.py |
Removes unsafe string handling in favor of type-level serialization. |
.chronus/changes/copilot-fix-python-sample-serializer-2026-10-5-2-43-37.md |
Documents the sample literal fix and header-value preservation. |
Review effort: Balanced
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Resolved and pushed in merge commit |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Quoted ETag examples produced invalid Python such as
if_match=""""1"""", causing BlackUnterminatedStringerrors in generated samples. Serialization must preserve the quotation marks required by the header value.reprfor strings.If-Matcharguments in complete samples.For
"If-Match": "\"1\"", the generated argument becomes: