Implement Spector integration tests for azure/client-generator-core/client-default-value#3835
Draft
Implement Spector integration tests for azure/client-generator-core/client-default-value#3835
Conversation
…lient-default-value Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com>
…fined check Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com>
Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Spector integration tests for client default value
Implement Spector integration tests for azure/client-generator-core/client-default-value
Mar 10, 2026
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.
Adds Spector integration test coverage for the
@clientDefaultValuedecorator scenarios, and fixes an emitter bug discovered in the process.Emitter fix: header params with
clientDefaultValueOptional header parameters with
@clientDefaultValuewere wrapped in anoptions?.param !== undefinedguard, which prevented the default from ever being sent when the caller omits the option. Since theparamMapalready includes a?? defaultfallback, the guard is unnecessary and incorrect.Before (broken):
After (fixed):
The fix is in
buildHeaderParameter()inoperationHelpers.ts: skip theundefinedconditional when the parameter has a type-matchingclientDefaultValue. This mirrors how query/path parameters with defaults are already handled.New test coverage
azure/client-generator-core/client-default-valuetoazureModularTspsincadl-ranch-list.jstspconfig.yaml,.gitignore,src/index.d.ts)azureClientGeneratorCoreClientDefaultValue.spec.tscovering all four scenarios:putModelProperty— model property defaults (timeout,tier,retry) returned by servergetOperationParameter— query param defaults (pageSize=10,format=json) auto-appliedgetPathParameter— path parameter with explicit default valuegetHeaderParameter— header defaults (accept,x-custom-header) auto-applied without caller inputclientDefaultValue.mdunit test snapshot to match corrected header emission@typespec/http-specsand@azure-tools/azure-http-specsto latest dev versions💡 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.