Skip to content

Fix Python sample literals for quoted If-Match ETags - #12499

Draft
Yuchao Yan (msyyc) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-python-sample-serializer
Draft

Yuchao Yan (msyyc) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-python-sample-serializer

Conversation

Copilot AI commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Quoted ETag examples produced invalid Python such as if_match=""""1"""", causing Black UnterminatedString errors in generated samples. Serialization must preserve the quotation marks required by the header value.

  • Serialization: Remove unsafe triple-quoting and delegate to the existing type-level serializer, which uses repr for strings.
  • Regression coverage: Check exact value preservation and Black formatting for quoted ETags and escaped strings; verify required If-Match arguments in complete samples.
  • Changelog: Add a Python emitter bug-fix entry.

For "If-Match": "\"1\"", the generated argument becomes:

if_match='"1"',

@azure-pipelines

Copy link
Copy Markdown
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>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Nov 5, 2026
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Python sample serializer for quoted If-Match ETags Fix Python sample literals for quoted If-Match ETags Nov 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Python sample serializer generates invalid literals for quoted If-Match ETags

2 participants