fix(python): support @clientDefaultValue on model properties + bump azure-http-specs to 0.1.0-alpha.40-dev.6#10461
Draft
fix(python): support @clientDefaultValue on model properties + bump azure-http-specs to 0.1.0-alpha.40-dev.6#10461
@clientDefaultValue on model properties + bump azure-http-specs to 0.1.0-alpha.40-dev.6#10461Conversation
… emitter to include clientDefaultValue, update spec version Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/e76e44d3-8913-4cc0-8f5e-b4844d172290 Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add test case for pull request 4300
fix(python): support Apr 22, 2026
@clientDefaultValue on model properties + bump azure-http-specs to 0.1.0-alpha.40-dev.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@clientDefaultValueon model properties was silently ignored by the Python emitter — the decorator's values were never forwarded to the code model, so generated models usedOptional[T] = Noneinstead of the correct default, and the SDK omitted those fields from serialized request bodies.Root cause
emitPropertyinemitter/src/types.tsdid not includeclientDefaultValuein its output (unlike the HTTP parameter path inhttp.ts, which handled it correctly).Changes
emitter/src/types.ts— addclientDefaultValue: property.clientDefaultValuetoemitPropertyreturn value so model property defaults flow through to the code model.package.json— bump@azure-tools/azure-http-specs0.1.0-alpha.39→0.1.0-alpha.40-dev.6, which includes the mock fix from Fix client-default-value mock to always include client defaults in request Azure/typespec-azure#4300 (PUT body now requires client defaults, exposing the bug above).Effect on generated code
Before:
After:
ModelWithDefaultValues(name="test")now serializes to{"name": "test", "timeout": 30, "tier": "standard", "retry": true}as expected.