[python] Fix @clientDefaultValue serialization regression from #10476#10546
Conversation
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/91e8124d-723d-42e3-a606-d2e9fa8cd443 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
|
|
@copilot the changes in the pipeline setup is causing these errors Stage CSharp_Build job DetectApiChanges depends on unknown job Build_linux_20. |
... Reverted the unrelated pipeline changes from commit |
|
@copilot we still need to do 22 and up, with your last change, we got this failure on the
##[error]PowerShell exited with code '1'. |
Agreed — upgraded the emitter pipelines to drop Node 20 entirely in |
Pull request was converted to draft
d462382 to
f56d56f
Compare
…ft/typespec into copilot/fix-issue-with-typespec
|
@iscai-msft CI is fixed and pls help review again, thanks! |
## Problem All Python CI runs are consistently failing with 2 test failures: - `test_put_model_property` (sync) in `test_azure_client_generator_core_client_default_value.py` - `test_put_model_property` (async) in `test_azure_client_generator_core_client_default_value_async.py` The error is: ``` Body provided doesn't match expected body: at $: Key count mismatch: expected 4 but got 1. missing: [timeout, tier, retry] ``` ## Root Cause The catalog specifies `@typespec/http-client-python: ^0.28.3`. For 0.x semver, `^0.28.3` means `>=0.28.3 <0.29.0`, so version `0.29.0` (which contains the `@clientDefaultValue` serialization fix from [microsoft/typespec#10546](microsoft/typespec#10546)) is excluded. The `azure-http-specs` mock API was updated to validate that `@clientDefaultValue` defaults are included in request bodies, but the installed generator version (0.28.3) doesn't serialize them. ## Fix - Bump catalog to `^0.29.0` - Add `@typespec/http-client-python` to `minimumReleaseAgeExclude` (0.29.0 was published <2 days ago) --------- Co-authored-by: iscai-msft <isabellavcai@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix follow-up for #10476: restore client default value materialization for serialization, plus a couple of regenerator-tooling changes that landed on the same branch.
Addresses review comment r3160211783 on PR #10476.
Changes
Model.__init__(generator/pygen/codegen/templates/model_base.py.jinja2) so@clientDefaultValuedefaults are present in_dataand serialized on the wire (the_RestField.__get__fallback for unset fields is kept intact).eng/scripts/ci/regenerate.tsinto a neweng/scripts/ci/regenerate-common.tsmodule so the file can be kept byte-identical with the@azure-tools/typespec-pythonwrapper copy (pnpm sync). Per-repo divergence (paths, emitter name, single- vs two-phase orchestration, argv/help text) stays in each repo's ownregenerate.ts, which now builds aRegenerateContextand feeds it into the shared helpers.@azure-tools/azure-http-specsfrom0.1.0-alpha.39to0.1.0-alpha.40-dev.12inpackage.json