Skip to content

feat: add enable-storage-compat emitter option#3814

Merged
joheredi merged 4 commits intoAzure:mainfrom
joheredi:feature/enable-storage-compat
Mar 5, 2026
Merged

feat: add enable-storage-compat emitter option#3814
joheredi merged 4 commits intoAzure:mainfrom
joheredi:feature/enable-storage-compat

Conversation

@joheredi
Copy link
Copy Markdown
Member

@joheredi joheredi commented Mar 4, 2026

Add a new emitter flag enable-storage-compat (default: false) that augments every regular (non-LRO, non-paging) operation return type with a _response property containing:

  • rawResponse: PipelineResponse captured via the onResponse callback
  • parsedBody: the deserialized response body
  • parsedHeaders: the deserialized response headers

Implementation uses a static helper pattern (storageCompatResponse.ts) with:

  • StorageCompatResponseInfo<TBody, THeaders> type
  • createStorageCompatOnResponse() to intercept the PipelineResponse
  • addStorageCompatResponse() to augment the return value

Files changed:

  • lib.ts, interfaces.ts, transfromRLCOptions.ts: option definition and plumbing
  • static-helpers-metadata.ts, index.ts: helper registration and conditional loading
  • operationHelpers.ts: operation generation with onResponse injection
  • storageCompatResponse.ts: new static helper
  • docs/storage-compat-response.md: feature design documentation
  • Scenario tests and unit tests for full coverage

Add a new emitter flag `enable-storage-compat` (default: false) that augments
every regular (non-LRO, non-paging) operation return type with a `_response`
property containing:
- `rawResponse`: PipelineResponse captured via the onResponse callback
- `parsedBody`: the deserialized response body
- `parsedHeaders`: the deserialized response headers

Implementation uses a static helper pattern (storageCompatResponse.ts) with:
- `StorageCompatResponseInfo<TBody, THeaders>` type
- `createStorageCompatOnResponse()` to intercept the PipelineResponse
- `addStorageCompatResponse()` to augment the return value

Files changed:
- lib.ts, interfaces.ts, transfromRLCOptions.ts: option definition and plumbing
- static-helpers-metadata.ts, index.ts: helper registration and conditional loading
- operationHelpers.ts: operation generation with onResponse injection
- storageCompatResponse.ts: new static helper
- docs/storage-compat-response.md: feature design documentation
- Scenario tests and unit tests for full coverage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
joheredi and others added 3 commits March 4, 2026 23:31
…sponse

FullOperationResponse extends PipelineResponse and is the actual type
received by the onResponse callback. This provides access to additional
properties like rawHeaders and parsedBody on the raw response object.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n/deserialization

Add shouldSkipHeaderSerialization() predicate that checks getClientOptions(header,
"headerCollectionPrefix") to filter headers at 4 collection points:
- Request headers in getHeaderAndBodyParameters()
- Response headers in getResponseHeaders()
- Exception headers in getExceptionResponseHeaders()
- Composite response types in buildCompositeResponseType()

Headers with this option are excluded from ser/deser codegen but remain in
model/type definitions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joheredi joheredi merged commit e2248a0 into Azure:main Mar 5, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants