From e3475bc17b13aa1e4686aa09f2bd2c48a08b8ef7 Mon Sep 17 00:00:00 2001 From: EmmaZhu-MSFT Date: Wed, 20 Nov 2024 00:52:36 -0800 Subject: [PATCH] Update blob swagger spec to a commit on main branch (#31851) ### Packages impacted by this PR ### Issues associated with this PR ### Describe the problem that is addressed by this PR ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary) --- sdk/storage/storage-blob/swagger/README.md | 54 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/sdk/storage/storage-blob/swagger/README.md b/sdk/storage/storage-blob/swagger/README.md index 9783d1ae52c..aa4a7932551 100644 --- a/sdk/storage/storage-blob/swagger/README.md +++ b/sdk/storage/storage-blob/swagger/README.md @@ -12,7 +12,7 @@ enable-xml: true generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../src/generated -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2d3b08fe43bc4a573acd166d3d2ba0c631b016fb/specification/storage/data-plane/Microsoft.BlobStorage/stable/2025-01-05/blob.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/b478dcdabacb37945ff89daa0eda1ae1afc98db4/specification/storage/data-plane/Microsoft.BlobStorage/stable/2025-01-05/blob.json model-date-time-as-string: true optional-response-headers: true v3: true @@ -1483,4 +1483,56 @@ directive: transform: $.enum = [ "2025-01-05" ]; ``` +### Remove structured body parameters. + +```yaml +directive: + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}]["get"] + transform: > + $["parameters"] = $["parameters"].filter(function(param) { return false == param['$ref'].endsWith("#/parameters/StructuredBodyGet")}); + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}"]["get"]["responses"]["200"]["headers"] + transform: > + delete $["x-ms-structured-body"]; + delete $["x-ms-structured-content-length"]; + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}"]["get"]["responses"]["200"]["headers"] + transform: > + delete $["x-ms-structured-body"]; + delete $["x-ms-structured-content-length"]; + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?BlockBlob"]["put"] + transform: > + $["parameters"] = $["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/StructuredBodyPut") && false == param['$ref'].endsWith("#/parameters/StructuredContentLength"))}); + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?BlockBlob"]["put"]["responses"]["201"]["headers"] + transform: > + delete $["x-ms-structured-body"]; + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=block"]["put"] + transform: > + $["parameters"] = $["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/StructuredBodyPut") && false == param['$ref'].endsWith("#/parameters/StructuredContentLength"))}); + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=block"]["put"]["responses"]["201"]["headers"] + transform: > + delete $["x-ms-structured-body"]; + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update"]["put"] + transform: > + $["parameters"] = $["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/StructuredBodyPut") && false == param['$ref'].endsWith("#/parameters/StructuredContentLength"))}); + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update"]["put"]["responses"]["201"]["headers"] + transform: > + delete $["x-ms-structured-body"]; + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"]["put"] + transform: > + $["parameters"] = $["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/StructuredBodyPut") && false == param['$ref'].endsWith("#/parameters/StructuredContentLength"))}); + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"]["put"]["responses"]["201"]["headers"] + transform: > + delete $["x-ms-structured-body"]; +``` + ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fstorage%2Fstorage-blob%2Fswagger%2FREADME.png)