Skip to content

Commit 1bdafdb

Browse files
catalinaperaltampodwysockicperaltahjhendrixMSFTvincenttran-msft
authored
Storage Blob swagger to typespec migration (#32527)
* [Storage Blob] Updating routes * [Storage Blob] Updating routes * [Storage Blob] Updating routes * [Storage Blob] Updating routes * [Storage Blob] Updating routes * [storage] Update models * [storage] Update models * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] update the routes * [storage blob] Fix dependencies * [Storage Blob] Updating routes * Update blob path parameter * tsp format * fix blob path param * regen openapi * add suppressions * update code dependency * remove package.json + lock * fix query params * fix versioning * refactor interface usage, fix operation ids * tcgc cleanup * import cleanup * update namespace * remove old versions * update tspconfig.yaml * fix versions, regen openapi * add template * clean up headers * use template, regen * remove operation id suppressions * clientName clean up * clean up headers and template * add rust configs * clean up and fix models * fix routes * regen openapi * add content type to template * revert - package.json update * rename endpoint param * move version param to client init * model corrections * update routes and openapi * remove incorrect file changes * undo package json changes * add missing param * fix tspconfig.yaml example dir * specify page response * add missing header * more spec fixes * more spec fixes - container interface * specify client parameters * regen openapi * fix blob interface operations * regen openapi * fix pageblob operations * move base blob interface route to each operation * use template where possible * fix appendblob operations * fix NextMarker casing * regen openapi * update blockblob operations * clean up more models and routes * accuracy updates * add placeholders for metadata and object replication headers * update multipart/mixed content type * update to 2025-01-05 api version * reset swagger * tspconfig.yaml updates * example placeholder * fix collection headers * fixes * revert wip * regen openapi * add continuation token decorator * simplify spec * add linter suppression * regen openapi * clean up * regen openapi * use apiVersion decorator * add typespec/xml to package.json * remove duplicate x-ms-version headers * spelling * comment out @pagedResult decorator * spelling + openapi regen * update SignedIdentifiers * clean up * clean up * remove containerName param from client * add client customizations * add other interfaces * clean up some doc comments * add missing x-ms-blob-type header * update lock file * regen openapi * update blob type * add missing content type for appendBlock * Add initial crate-version, rename package-dir and crate-name (#32687) * make request and response media types configurable moved query to block blob as it's specific to that blob type * fix client naming for x-ms-meta and x-ms-or headers for Rust * fix headers that contain time stamps * consolidate redundant response headers * fix getBlockList * suppress swagger lint error * update namespace structure + client customizations * openapi * fix service operations * clean up routes * update suppression * update refs to blob namespace * nest append/block/page blobs under container * Use uint64 in Rust for content length headers * fix client names for Rust * regen openapi * fix routes * manually add slash to paths for ci * fix bad application of clientName on alias * Correct package name from plural to singular * revert openapi edit * fix base64 encoded block IDs * fix routes redux * Rename path param blob to blobName The previous name was a holdover from the swagger. The SDKs use blobName as the parameter name. * mark unwanted headers as internal for clients * regen openapi * suppress examples error * manual swagger path update * Move append/block/page blobs to children of blob Revert previous change to DateResponseHeader * don't use URL encoding for block ID * [Storage] Omit response headers for certain headers (#33593) * Disable doc links for Rust codegen Temporarily switched multipart/mixed to application/octec-stream until the Rust emitter supports multipart/mixed. * Improvement on 4e80be1 * Remove additionalDirectories from deps * Remove response headers from set_metadata (#33966) * [Storage] `set_properties` TypeSpec Change (#33939) * Omit response headers (#33970) * revert changes to package.json * suppress record type issue * modify openapi * modify metadata header type * openapi * tsp format * modify openapi * suppress examples error * suppress multipart issue * fix suppression * add suppression for base64 type * clean up * revert x-ms-meta x-ms-or header type * fix breaking changes * update openapi * update metadata headers * fix header * openapi / * update listContainersSegment to be pageable * update remaining pageable operations * Adjust route for start_copy_from_url (#34359) * remove auth * refactor * add docs * move xml.name decorator back to models removed from response as it has no effect * fix XML schema for list blobs operations * Update specification/storage/Microsoft.BlobStorage/tspconfig.yaml * fix route issee and remove content type on no body * wip * fix no body ops * Revert "wip" This reverts commit 20bc5de. * test swagger checks * Add mediaTypeHint to StorageError response Added missing Code field to StorageError. Removed unused using statements. * [Storage] Fix extraneous `?<BlobType>` in RequestURI TypeSpec Changes (#35133) * make content-length a fixed value for some operations When creating append and page blobs, the initial content-length must be set to zero, no need for a parameter. * Revert header removal (#35187) * Revert "[Storage] Omit response headers for certain headers (#33593)" This reverts commit 3a46f7c. * Revert "Remove response headers from set_metadata (#33966)" This reverts commit dee1773. * manual revert of 55c6629 routes.tsp changes * Revert "Omit response headers (#33970)" This reverts commit a7ede23. * regen openapi * fix server encrypted headers * regen openapi * remove extra clientName decorator --------- Co-authored-by: catalinaperalta <[email protected]> * Update blob spec to use latest api version (#35231) * update base api version * add filerequestintent * add new copy headers * update storage error model * update openapi spec --------- Co-authored-by: catalinaperalta <[email protected]> * reset swagger to main * update placeholder file * fix more no body ops * fix enums * remove enum member ref * add custom request id headers * ci check * add x-ms-error header * fix immutability policy mode enum * move scope decorator to client.tsp * add lease action header * regen openapi * add missing headers * add missing headers * fix error headers * ci * fix more headers * fix more headers and parms * fix access tier * fix header literal * fix header enum * fix response headers * format + fix response header ref * tsp format * regen openapi * [Storage] Move to `Access.internal` for Hiding Result Headers (#35254) * [Storage] `PageBlobClient` and `AppendBlobClient` initial introduction TypeSpec Changes (#35396) * [Storage] Lease operations and `AppendBlobClient` feature parity TypeSpec Changes (#35564) * Make lease duration non-optional * Adjust ResultHeaders for lease operations, rest of AppendBlobClient APIs * Switch to privatization not removal * [Storage] Prep `.tsp` for `v0.3.0` release of Blob Storage SDK (#35886) * regen openapi * suppressions * rename swagger * reset swagger to main * update readme * update readme * revert change * regen swagger * suppressions * suppressions * add suppression * From ETag to Etag to match response body (#36377) * empty * remove extra suppressions * [Storage] `get_page_ranges`, `update_sequence_number` and `upload_pages_from_url` TypeSpec Changes (#36311) * [Storage] Regen after latest (#36594) * [Storage] Recompile after `.tsp` changes (#36649) --------- Co-authored-by: Matthew Podwysocki <[email protected]> Co-authored-by: Catalina Peralta <[email protected]> Co-authored-by: Joel Hendrix <[email protected]> Co-authored-by: vincenttran-msft <[email protected]> Co-authored-by: Vincent Tran <[email protected]> Co-authored-by: Jiao Di (MSFT) <[email protected]> Co-authored-by: Mike Harder <[email protected]>
1 parent 63c69fb commit 1bdafdb

File tree

9 files changed

+23191
-29
lines changed

9 files changed

+23191
-29
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
import "./main.tsp";
3+
4+
using TypeSpec.Http;
5+
using Azure.ClientGenerator.Core;
6+
using Storage.Blob;
7+
8+
namespace Customizations;
9+
10+
/** Parameters to be added in client constructors */
11+
model BlobServiceClientParameters {
12+
...ContainerNamePathParameter;
13+
...BlobPathParameter;
14+
}
15+
16+
@@clientNamespace(Storage.Blob, "Azure.Storage.Blobs");
17+
@@clientNamespace(Storage.Blob.Container, "Azure.Storage.Blobs");
18+
@@clientNamespace(Storage.Blob.Container.Blob, "Azure.Storage.Blobs");
19+
@@clientNamespace(Storage.Blob.Container.Blob.AppendBlob,
20+
"Azure.Storage.Blobs"
21+
);
22+
@@clientNamespace(Storage.Blob.Container.Blob.BlockBlob, "Azure.Storage.Blobs");
23+
@@clientNamespace(Storage.Blob.Container.Blob.PageBlob, "Azure.Storage.Blobs");
24+
25+
@@clientName(Storage.Blob, "BlobServiceClient", "rust");
26+
@@clientName(Storage.Blob.Container, "BlobContainerClient", "rust");
27+
@@clientName(Storage.Blob.Container.Blob, "BlobClient", "rust");
28+
@@clientName(Storage.Blob.Container.Blob.AppendBlob,
29+
"AppendBlobClient",
30+
"rust"
31+
);
32+
@@clientName(Storage.Blob.Container.Blob.BlockBlob, "BlockBlobClient", "rust");
33+
@@clientName(Storage.Blob.Container.Blob.PageBlob, "PageBlobClient", "rust");
34+
35+
@@clientInitialization(Storage.Blob.Container,
36+
{
37+
parameters: ContainerNamePathParameter,
38+
initializedBy: InitializedBy.parent | InitializedBy.individually,
39+
}
40+
);
41+
@@clientInitialization(Storage.Blob.Container.Blob,
42+
{
43+
parameters: BlobServiceClientParameters,
44+
initializedBy: InitializedBy.parent | InitializedBy.individually,
45+
}
46+
);
47+
@@clientInitialization(Storage.Blob.Container.Blob.AppendBlob,
48+
{
49+
parameters: BlobServiceClientParameters,
50+
initializedBy: InitializedBy.parent | InitializedBy.individually,
51+
}
52+
);
53+
@@clientInitialization(Storage.Blob.Container.Blob.BlockBlob,
54+
{
55+
parameters: BlobServiceClientParameters,
56+
initializedBy: InitializedBy.parent | InitializedBy.individually,
57+
}
58+
);
59+
@@clientInitialization(Storage.Blob.Container.Blob.PageBlob,
60+
{
61+
parameters: BlobServiceClientParameters,
62+
initializedBy: InitializedBy.parent | InitializedBy.individually,
63+
}
64+
);
65+
66+
@@clientName(ContainerProperties.denyEncryptionScopeOverride,
67+
"PreventEncryptionScopeOverride"
68+
);
69+
@@clientName(ContainerProperties.immutableStorageWithVersioningEnabled,
70+
"IsImmutableStorageWithVersioningEnabled"
71+
);
72+
@@clientName(BlobPropertiesInternal.expiryTime, "ExpiresOn");
73+
@@clientName(BlobPropertiesInternal.sealed, "IsSealed");
74+
@@clientName(BlobPropertiesInternal.lastAccessTime, "LastAccessedOn");
75+
@@clientName(BlobPropertiesInternal.immutabilityPolicyUntilDate,
76+
"ImmutabilityPolicyExpiresOn"
77+
);
78+
79+
@@clientName(MetadataHeaders.metadata, "metadata", "rust");
80+
@@clientName(ObjectReplicationHeaders.objectReplicationRules,
81+
"objectReplicationRules",
82+
"rust"
83+
);
84+
85+
@@alternateType(BlobPropertiesInternal.contentLength, uint64, "rust");
86+
@@alternateType(BlobContentLengthRequired.blobContentLength, uint64, "rust");
87+
@@alternateType(ContentLengthResponseHeader.contentLength, uint64, "rust");
88+
@@alternateType(ContentLengthParameter.contentLength, uint64, "rust");
89+
@@alternateType(StructuredContentLengthParameter.structuredContentLength,
90+
uint64,
91+
"rust"
92+
);
93+
@@alternateType(StructuredContentLengthResponseHeader.structuredContentLength,
94+
uint64,
95+
"rust"
96+
);
97+
98+
@@scope(Storage.Blob.Container.submitBatch, "!rust");
99+
@@scope(Storage.Blob.submitBatch, "!rust");

specification/storage/Microsoft.BlobStorage/examples/2025-11-05/placeholder.md

Whitespace-only changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import "@typespec/rest";
2+
import "@typespec/versioning";
3+
import "@azure-tools/typespec-azure-core";
4+
import "./routes.tsp";
5+
6+
using TypeSpec.Http;
7+
using TypeSpec.Rest;
8+
using TypeSpec.Versioning;
9+
using Azure.Core;
10+
11+
@useAuth(
12+
OAuth2Auth<[
13+
{
14+
type: OAuth2FlowType.implicit,
15+
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize",
16+
scopes: ["https://storage.azure.com/.default"],
17+
}
18+
]>
19+
)
20+
@service(#{ title: "Azure Storage Blob service" })
21+
@server(
22+
"{url}",
23+
"The host name of the blob storage account, e.g. accountName.blob.core.windows.net",
24+
{
25+
@doc("The host name of the blob storage account, e.g. accountName.blob.core.windows.net")
26+
url: url,
27+
}
28+
)
29+
@versioned(Versions)
30+
namespace Storage.Blob;
31+
32+
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard typespec recommendation"
33+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Following standard typespec recommendation"
34+
@doc("The Azure.Storage.Blob service versions.")
35+
enum Versions {
36+
@doc("The 2025-11-05 version of the Azure.Storage.Blob service.")
37+
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
38+
v2025_11_05: "2025-11-05",
39+
}

0 commit comments

Comments
 (0)