feat: add Spector integration tests for Payload_Head and Payload_JsonMergePatch#4007
feat: add Spector integration tests for Payload_Head and Payload_JsonMergePatch#4007Copilot wants to merge 4 commits into
Conversation
| // The generated client returns void for HEAD operations; response headers | ||
| // (Content-Type and x-ms-meta) are validated by the mock server (returns 200 | ||
| // only when the request is correct). No header assertions can be made here | ||
| // because the emitter does not expose response headers in the return type. |
There was a problem hiding this comment.
I don't have the ability to create GitHub issues directly. Please create an issue with the following details:
Title: [Emitter] HEAD operations should surface response headers in the return type
Description:
The TypeSpec emitter generates Promise<void> for HEAD operations (e.g. HeadClient.contentTypeHeaderInResponse()), which means response headers (Content-Type, x-ms-meta) are not accessible from the returned value. This is an emitter limitation — the TypeSpec spec defines these headers as part of the response, but the generated SDK discards them.
Scenario: Payload_Head / contentTypeHeaderInResponse (payload/head/content-type-header-in-response)
Expected behavior: The generated method should return an object containing the response headers, e.g.:
{ contentType?: string; metadata?: string }Actual behavior: Returns Promise<void>, making header assertions impossible in integration tests.
Related test: packages/typespec-ts/test/azureModularIntegration/payloadHead.spec.ts
Adds Spector integration test coverage for two previously untested scenario groups:
Payload_HeadandPayload_JsonMergePatch.Changes
test/commands/spector-list.js: Addedpayload/headandpayload/json-merge-patchentries to theazureModularTspsarray.test/azureModularIntegration/generated/payload/head/: Addedtspconfig.yaml,.gitignore, and generatedsrc/index.d.tsfor theHeadClient.test/azureModularIntegration/generated/payload/json-merge-patch/: Addedtspconfig.yaml,.gitignore, and generatedsrc/index.d.tsfor theJsonMergePatchClient.test/azureModularIntegration/payloadHead.spec.ts: New spec coveringcontentTypeHeaderInResponse(HEAD request; mock server validates 200).test/azureModularIntegration/payloadJsonMergePatch.spec.ts: New spec coveringcreateResource(PUT with full body),updateResource, andupdateOptionalResource(PATCH with JSON merge-patch null field-removal semantics).Known emitter limitations
HeadClient.contentTypeHeaderInResponse()returnsPromise<void>; response headers (Content-Type,x-ms-meta) are not surfaced by the emitter. Server validation on 200 is the effective assertion.ResourcePatchtype uses?(optional) fields rather thanT | null, soas anycasts are required to passnullvalues for field-removal. The serializer preservesnullat runtime correctly.