feat: add enable-storage-compat emitter option#3814
Merged
joheredi merged 4 commits intoAzure:mainfrom Mar 5, 2026
Merged
Conversation
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>
…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>
jeremymeng
approved these changes
Mar 5, 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.
Add a new emitter flag
enable-storage-compat(default: false) that augments every regular (non-LRO, non-paging) operation return type with a_responseproperty containing:rawResponse: PipelineResponse captured via the onResponse callbackparsedBody: the deserialized response bodyparsedHeaders: the deserialized response headersImplementation uses a static helper pattern (storageCompatResponse.ts) with:
StorageCompatResponseInfo<TBody, THeaders>typecreateStorageCompatOnResponse()to intercept the PipelineResponseaddStorageCompatResponse()to augment the return valueFiles changed: