Skip to content

[Storage] Migrate azure-storage-blob to Typespec - #51353

Draft
Isabelle (ibrandes) wants to merge 11 commits into
Azure:mainfrom
ibrandes:blob-datalake-tsp-migration/blob
Draft

Isabelle (ibrandes) wants to merge 11 commits into
Azure:mainfrom
ibrandes:blob-datalake-tsp-migration/blob

Conversation

@ibrandes

Copy link
Copy Markdown
Member

No description provided.

Isabelle (ibrandes) and others added 2 commits November 19, 2026 14:31
- Regenerate azure-storage-blob from the BlobStorage TypeSpec with the Java emitter;
  swagger/ is replaced by customization/ (BlobStorageCustomizations).
- Rewire the hand-written clients onto the generated layer, map generated errors to
  BlobStorageException, and stream download and query bodies.
- Range operations send the standard Range header; tests and mocks updated.
- Update blob-batch and dependents' tests for the new Accept and Range headers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Nov 19, 2026
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

The sdk-api-review-ready label cannot create a review PR for this working PR because its branch is in a fork repository. Prefer a working branch in the registered upstream repository, or reach out to the ARH maintainers for help. Fork reviews are supported through the Azure SDK CLI (azsdk apireview create), but the fork requires its own ARH registration and the review PR is created in the fork rather than the upstream repository.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
33 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Regenerated with eng/scripts/generate_reflect_config.py. Removes entries for classes that no
longer exist and adds the TypeSpec-generated types that are accessed reflectively: models the
generated XmlSerializer reads through fromXml (BlobLayoutInternal, BlobSignedIdentifiers,
CreateSessionResponse) and the BlobStorageErrorException/BlobStorageError error mapping.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Encrypted ranged downloads now send Range, but the decryption policy still handles only x-ms-range, skipping the ciphertext-range expansion needed for correct decryption.

3 open issues
What changed in this PR

Migrates Azure Blob Storage code generation from AutoRest to TypeSpec and adapts the client integration, models, and dependent Storage tests.

Changes:

  • Adds TypeSpec source configuration and XML serialization helpers, replaces generated models, and removes obsolete AutoRest artifacts.
  • Updates client construction, request options, batch payload handling, and Arrow listing results.
  • Adapts tests to standard Range headers and generated APIs, adds deserialization coverage, and documents migration behavior.

Paths are abbreviated where needed; each row represents one changed file.

File Description
azure-storage-file-datalake/​…/​DataLakeTestBase.java Excludes Accept from playback matching.
azure-storage-file-datalake/​…/​DataLakeDataLocalityOptionsTests.java Reads standard Range headers in mocks.
azure-storage-common/​…/​MockRetryRangeResponsePolicy.java Accepts both range-header names.
azure-storage-blob/​tsp-location.yaml Pins the TypeSpec source.
azure-storage-blob/​swagger/​Update-Codegeneration.ps1 Removes the AutoRest generation entry point.
azure-storage-blob/​swagger/​package.json Removes the obsolete Swagger manifest.
azure-storage-blob/​…/​specialized/​DownloadResponseMockFlux.java Updates range capture in download mocks.
azure-storage-blob/​…/​specialized/​BlockBlobApiTests.java Uses regenerated upload response headers.
azure-storage-blob/​…/​specialized/​BlobDataLocalityDownloadApiTests.java Updates mock range handling.
azure-storage-blob/​…/​specialized/​BlobClientBaseTests.java Updates synchronous range assertions and mocks.
azure-storage-blob/​…/​specialized/​BlobAsyncClientBaseTests.java Adds empty-layout coverage and updates range assertions.
azure-storage-blob/​…/​implementation/​util/​ModelHelperTests.java Constructs response-only layout models through XML.
azure-storage-blob/​…/​implementation/​util/​BlobListArrowGoldenDecodeTests.java Verifies public BlobItem decoding results.
azure-storage-blob/​…/​implementation/​models/​BlobHierarchyListSegmentTests.java Adds hierarchical-list deserialization cases.
azure-storage-blob/​…/​ContainerAsyncApiTests.java Adapts asynchronous Arrow and range tests.
azure-storage-blob/​…/​ContainerApiTests.java Adapts synchronous Arrow and range tests.
azure-storage-blob/​…/​BlobTestBase.java Adjusts playback matching and range logging.
azure-storage-blob/​…/​BlobErrorDeserializationTests.java Adds XML and JSON error-response coverage.
azure-storage-blob/​…/​BlobContentValidationUploadTests.java Checks standard page-upload range headers.
azure-storage-blob/​…/​BlobContentValidationAsyncUploadTests.java Updates asynchronous page-upload range assertions.
azure-storage-blob/​…/​BlobAsyncApiTests.java Updates session-download range capture.
azure-storage-blob/​…/​BlobApiTests.java Updates synchronous session-download range capture.
azure-storage-blob/​src/​main/​java/​module-info.java Adds a transitive Azure Core requirement.
azure-storage-blob/​…/​specialized/​ReliableDownload.java Passes raw headers to download-header mapping.
azure-storage-blob/​…/​specialized/​BlobLeaseClientBuilder.java Passes typed service versions to lease clients.
azure-storage-blob/​…/​specialized/​AppendBlobClient.java Routes operations through internal clients and request options.
azure-storage-blob/​…/​blob/​package-info.java Refreshes generated package documentation.
azure-storage-blob/​…/​models/​TaggedBlobItem.java Marks the model as hand-maintained.
azure-storage-blob/​…/​models/​SyncCopyStatusType.java Marks the type as hand-maintained.
azure-storage-blob/​…/​models/​SkuName.java Refreshes generator attribution and JavaDoc.
azure-storage-blob/​…/​models/​SequenceNumberActionType.java Refreshes generated enum documentation.
azure-storage-blob/​…/​models/​RehydratePriority.java Refreshes priority documentation.
azure-storage-blob/​…/​models/​PublicAccessType.java Reorders declarations and refreshes documentation.
azure-storage-blob/​…/​models/​PathRenameMode.java Marks the type as hand-maintained.
azure-storage-blob/​…/​models/​PageList.java Refreshes generated property documentation.
azure-storage-blob/​…/​models/​package-info.java Updates public-model package documentation.
azure-storage-blob/​…/​models/​ListBlobsIncludeItem.java Clarifies listing-option documentation.
azure-storage-blob/​…/​models/​ListBlobContainersIncludeType.java Clarifies container-listing options.
azure-storage-blob/​…/​models/​LeaseStatusType.java Refreshes lease-status documentation.
azure-storage-blob/​…/​models/​LeaseStateType.java Refreshes lease-state documentation.
azure-storage-blob/​…/​models/​LeaseDurationType.java Refreshes lease-duration documentation.
azure-storage-blob/​…/​models/​GeoReplicationStatus.java Refreshes replication-status documentation.
azure-storage-blob/​…/​models/​FileShareTokenIntent.java Refreshes token-intent documentation.
azure-storage-blob/​…/​models/​EncryptionAlgorithmType.java Updates encryption enum documentation.
azure-storage-blob/​…/​models/​DeleteSnapshotsOptionType.java Clarifies snapshot-deletion options.
azure-storage-blob/​…/​models/​CpkInfo.java Marks the model as hand-maintained.
azure-storage-blob/​…/​models/​CopyStatusType.java Refreshes copy-status documentation.
azure-storage-blob/​…/​models/​BlockLookupList.java Refreshes generated documentation and formatting.
azure-storage-blob/​…/​models/​BlockListType.java Clarifies block-list selection options.
azure-storage-blob/​…/​models/​BlockList.java Refreshes block-list model documentation.
azure-storage-blob/​…/​models/​BlobType.java Refreshes blob-type documentation.
azure-storage-blob/​…/​models/​BlobServiceStatistics.java Refreshes statistics documentation and formatting.
azure-storage-blob/​…/​models/​BlobPrefix.java Marks the model as hand-maintained.
azure-storage-blob/​…/​models/​BlobItemProperties.java Uses the regenerated sealed-property setter.
azure-storage-blob/​…/​models/​BlobItem.java Stores prefix state in the public wrapper.
azure-storage-blob/​…/​models/​BlobImmutabilityPolicyMode.java Changes serialized enum values to lowercase.
azure-storage-blob/​…/​models/​BlobHttpHeaders.java Marks the model as hand-maintained.
azure-storage-blob/​…/​models/​BlobDownloadAsyncResponse.java Supplies raw headers during response mapping.
azure-storage-blob/​…/​models/​BlobCopySourceTagsMode.java Marks the type as hand-maintained.
azure-storage-blob/​…/​models/​BlobContainerEncryptionScope.java Marks the model as hand-maintained.
azure-storage-blob/​…/​models/​ArchiveStatus.java Refreshes archive-status documentation.
azure-storage-blob/​…/​models/​AccountKind.java Refreshes account-kind documentation.
azure-storage-blob/​…/​models/​AccessTier.java Refreshes access-tier documentation.
azure-storage-blob/​…/​implementation/​XmlSerializerProviders.java Adds an XML serializer factory.
azure-storage-blob/​…/​implementation/​XmlSerializer.java Adds Azure XML serialization support.
azure-storage-blob/​…/​implementation/​util/​SessionAcquirer.java Adapts session acquisition to generated clients.
azure-storage-blob/​…/​implementation/​util/​BuilderHelper.java Centralizes generated-client construction.
azure-storage-blob/​…/​implementation/​util/​BlobHeadersAndQueryParameters.java Allows standard Range header logging.
azure-storage-blob/​…/​implementation/​util/​ArrowBlobListDeserializer.java Returns public BlobItem instances.
azure-storage-blob/​…/​implementation/​package-info.java Refreshes implementation package documentation.
azure-storage-blob/​…/​implementation/​models/​SessionCredentials.java Converts credentials to a response-only model.
azure-storage-blob/​…/​implementation/​models/​ServicesSubmitBatchHeaders.java Removes the obsolete batch-header model.
azure-storage-blob/​…/​implementation/​models/​ServicesListContainersSegmentHeaders.java Adds regenerated container-list response headers.
azure-storage-blob/​…/​implementation/​models/​ServicesListBlobContainersSegmentNextHeaders.java Removes the old continuation-header model.
azure-storage-blob/​…/​implementation/​models/​ServicesListBlobContainersSegmentHeaders.java Removes the old container-list header model.
azure-storage-blob/​…/​implementation/​models/​QuerySerialization.java Uses constructor-based query-format initialization.
azure-storage-blob/​…/​implementation/​models/​QueryRequestType.java Adds the SQL query-request enum.
azure-storage-blob/​…/​implementation/​models/​QueryFormatType.java Refreshes query-format documentation.
azure-storage-blob/​…/​implementation/​models/​PremiumPageBlobAccessTier.java Refreshes premium-tier documentation.
azure-storage-blob/​…/​implementation/​models/​ParquetTextConfiguration.java Adds empty Parquet XML configuration support.
azure-storage-blob/​…/​implementation/​models/​PageListCollection.java Removes the obsolete page-list wrapper.
azure-storage-blob/​…/​implementation/​models/​package-info.java Refreshes internal-model package documentation.
azure-storage-blob/​…/​implementation/​models/​JsonTextConfigurationInternal.java Renames the internal JSON configuration model.
azure-storage-blob/​…/​implementation/​models/​FilterBlobsIncludeItem.java Refreshes filter-option documentation.
azure-storage-blob/​…/​implementation/​models/​EncryptionScope.java Marks the model as hand-maintained.
azure-storage-blob/​…/​implementation/​models/​DownloadHint.java Clarifies the layout download hint.
azure-storage-blob/​…/​implementation/​models/​DirectoryHttpHeaders.java Removes the obsolete directory parameter group.
azure-storage-blob/​…/​implementation/​models/​DirectoriesSetAccessControlHeaders.java Removes obsolete directory access-control headers.
azure-storage-blob/​…/​implementation/​models/​DirectoriesDeleteHeaders.java Removes obsolete directory deletion headers.
azure-storage-blob/​…/​implementation/​models/​DelimitedTextConfiguration.java Clarifies delimited-text configuration documentation.
azure-storage-blob/​…/​implementation/​models/​CreateSessionResponse.java Converts session responses to response-only models.
azure-storage-blob/​…/​implementation/​models/​CreateSessionConfiguration.java Initializes authentication type through the constructor.
azure-storage-blob/​…/​implementation/​models/​ContainersSubmitBatchHeaders.java Removes obsolete container batch headers.
azure-storage-blob/​…/​implementation/​models/​ContainersCreateSessionHeaders.java Adds generated session-response headers.
azure-storage-blob/​…/​implementation/​models/​BlobStorageExceptionInternal.java Removes the old internal exception.
azure-storage-blob/​…/​implementation/​models/​BlobStorageErrorException.java Renames the generated storage-error exception.
azure-storage-blob/​…/​implementation/​models/​BlobsSetAccessControlHeaders.java Removes obsolete blob access-control headers.
azure-storage-blob/​…/​implementation/​models/​BlobsAbortCopyFromUrlHeaders.java Adds generated abort-copy response headers.
azure-storage-blob/​…/​implementation/​models/​BlobPrefixInternal.java Converts prefixes to response-only models.
azure-storage-blob/​…/​implementation/​models/​BlobName.java Refreshes generated documentation and formatting.
azure-storage-blob/​…/​implementation/​models/​BlobLayoutRanges.java Removes mutable construction APIs from layout ranges.
azure-storage-blob/​…/​implementation/​models/​BlobLayoutEndpointsEndpointItem.java Makes endpoint fields constructor-initialized.
azure-storage-blob/​…/​implementation/​models/​BlobLayoutEndpoints.java Converts endpoint collections to response-only models.
azure-storage-blob/​…/​implementation/​models/​BlobHierarchyListSegment.java Adapts hierarchical listings to generated response models.
azure-storage-blob/​…/​implementation/​models/​BlobFlatListSegment.java Removes the obsolete flat-list wrapper.
azure-storage-blob/​…/​implementation/​models/​BlobExpiryOptions.java Refreshes expiry-option documentation.
azure-storage-blob/​…/​implementation/​models/​BlobDeleteType.java Replaces the expandable type with an enum.
azure-storage-blob/​…/​implementation/​models/​BlobCopySourceTags.java Adds an explicit null guard and refreshes documentation.
azure-storage-blob/​…/​implementation/​models/​AuthenticationType.java Refreshes generator attribution and HMAC documentation.
azure-storage-blob/​customization/​pom.xml Updates customization artifact metadata.
azure-storage-blob/​checkstyle-suppressions.xml Adjusts suppressions for regenerated classes.
azure-storage-blob/​CHANGELOG.md Documents migration, XML roots, and range-header changes.
azure-storage-blob-nio/​…/​BlobNioTestBase.java Adjusts playback header exclusions.
azure-storage-blob-cryptography/​…/​EncryptedBlockBlobAsyncApiTests.java Updates asynchronous retry-range assertions.
azure-storage-blob-cryptography/​…/​EncryptedBlockBlobApiTests.java Updates synchronous retry-range assertions.
azure-storage-blob-changefeed/​…/​BlobChunkedDownloaderTests.java Excludes Accept from playback matching.
azure-storage-blob-batch/​…/​BlobBatchTestBase.java Adjusts batch playback matching.
azure-storage-blob-batch/​…/​BlobBatchHelper.java Parses batch responses from BinaryData.
azure-storage-blob-batch/​…/​BlobBatchAsyncClient.java Adapts batch submission, content types, and resource paths.

Review effort: Balanced

Isabelle (ibrandes) and others added 4 commits November 19, 2026 16:20
… fluent restorations

- Block's deprecated int size accessors, the deprecated BlobErrorCode constants, the PageList
  accessor block and the empty Get Blob Layout check are now built from AST nodes instead of
  parsed source strings.
- Deprecated BlobErrorCode constants are placed after the constants that replace them.
- BlobAccessPolicy and BlockLookupList already generate in their shipped shape, so they're no
  longer restored.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…obImmutabilityPolicyMode values

- BlobDecryptionPolicy expands whichever range header the request carries (x-ms-range takes
  precedence, then Range). Blob downloads now send Range, so ranged encrypted downloads were not
  expanded to whole encryption blocks.
- BlobImmutabilityPolicyMode keeps its shipped Mutable/Unlocked/Locked values and order through a
  Java-only spec enum, which replaces its entry in restoreShippedEnumOrder.
- Pin tsp-location to the updated spec commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e Range header

Blob range operations now send the standard Range header instead of x-ms-range. The
recorded request header is renamed accordingly (1,014 requests across 576 recordings);
the recorded values are unchanged, so playback still compares the ranges.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The spec declares blocklisttype required, so the generated convenience methods called
listType.toString(). A null type is passed through as null again, which the protocol layer
omits from the query; the service then returns committed blocks.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active findings identify misleading AES256 documentation and overly broad Checkstyle suppressions that should be replaced with final collection fields and ClientLogger-backed exception handling.

2 open issues
3 resolved since last review

Review effort: Balanced

Comment on lines +22 to +25
<suppress files="com.azure.storage.blob.implementation.models.BlobHierarchyListSegment.java" checks="io.clientcore.linting.extensions.checkstyle.checks.EnforceFinalFieldsCheck" />
<suppress files="com.azure.storage.blob.implementation.models.BlobLayoutEndpoints.java" checks="io.clientcore.linting.extensions.checkstyle.checks.EnforceFinalFieldsCheck" />
<suppress files="com.azure.storage.blob.implementation.models.BlobLayoutRanges.java" checks="io.clientcore.linting.extensions.checkstyle.checks.EnforceFinalFieldsCheck" />
<suppress files="com.azure.storage.blob.implementation.XmlSerializer.java" checks="io.clientcore.linting.extensions.checkstyle.checks.ThrowFromClientLoggerCheck" />

package com.azure.storage.blob.models;

/**
* Defines values for EncryptionAlgorithmType.
* The algorithm used to produce the encryption key hash.
Isabelle (ibrandes) and others added 4 commits November 22, 2026 12:31
- Rename implsToUpdate in the Blob customization.
- Pin tsp-location to Azure/azure-rest-api-specs; the spec commit is reachable through the
  upstream repository, and regeneration from it is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… original recordings

The spec uses the standard Range header. A customization renames it back to x-ms-range where
the generated code builds the request (6 @HeaderParam values and 16 RequestOptions headers),
so every pipeline sends the shipped header, including Data Lake's, Cryptography's and
caller-supplied ones.

This reverts the Range-specific changes: the renamed recordings (assets.json tags), the test
mocks and matchers that read Range, MockRetryRangeResponsePolicy, BlobDecryptionPolicy's Range
handling, the logged-header addition and the CHANGELOG entry.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants