sdk/storage/Azure.Storage.Files.Shares/src/autorest.md
Run dotnet build /t:GenerateCode to generate code.
input-file:
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/be46becafeb29aa993898709e35759d3643b2809/specification/storage/data-plane/Microsoft.FileStorage/stable/2026-04-06/file.json
generation1-convenience-client: true
# https://github.com/Azure/autorest/issues/4075
skip-semantics-validation: true
modelerfour:
seal-single-value-enum-by-default: true
helper-namespace: Azure.Storage.Common
directive:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
for (const property in $)
{
if (property.includes('/{shareName}/{directory}/{fileName}'))
{
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ShareName") && false == param['$ref'].endsWith("#/parameters/DirectoryPath") && false == param['$ref'].endsWith("#/parameters/FilePath"))});
}
else if (property.includes('/{shareName}/{directory}'))
{
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ShareName") && false == param['$ref'].endsWith("#/parameters/DirectoryPath"))});
}
else if (property.includes('/{shareName}'))
{
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ShareName"))});
}
}
directive:
- from: swagger-document
where: $.definitions
transform: >
$.Metrics.type = "object";
directive:
- from: swagger-document
where: $.parameters.FileCreationTime
transform: >
delete $.format;
- from: swagger-document
where: $.parameters.FileLastWriteTime
transform: >
delete $.format;
- from: swagger-document
where: $.parameters.FileChangeTime
transform: >
delete $.format;
directive:
- from: swagger-document
where: $.definitions.ErrorCode["x-ms-enum"]
transform: >
$.name = "ShareErrorCode";
directive:
- from: swagger-document
where: $.definitions
transform: >
$.ShareFileRangeList.xml = {
"name": "Ranges"
};
directive:
- from: swagger-document
where: $["x-ms-paths"]["/{shareName}/{directory}/{fileName}?comp=metadata"]
transform: >
$.put.responses["200"].headers["Last-Modified"] = {
"type": "string",
"format": "date-time-rfc1123",
"description": "Returns the date and time the file was last modified. Any operation that modifies the file, including an update of the file's metadata or properties, changes the last-modified time of the file."
}
directive:
- from: swagger-document
where: $["x-ms-paths"]["/{shareName}/{directory}/{fileName}?comp=range&fromURL"]
transform: >
$.put.responses["201"].headers["Content-MD5"] = {
"type": "string",
"format": "byte",
"description": "This header is returned so that the client can check for message content integrity. The value of this header is computed by the File service; it is not necessarily the same value as may have been specified in the request headers."
}
directive:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
Object.keys($).map(id => {
if (id.includes('/{shareName}/{directory}/{fileName}'))
{
$[id.replace('/{shareName}/{directory}/{fileName}', '?shareName_dir_file')] = $[id];
delete $[id];
}
else if (id.includes('/{shareName}/{directory}'))
{
$[id.replace('/{shareName}/{directory}', '?shareName_dir')] = $[id];
delete $[id];
}
else if (id.includes('/{shareName}'))
{
$[id.replace('/{shareName}', '?shareName')] = $[id];
delete $[id];
}
});
directive:
- from: swagger-document
where: $..[?(@.operationId=='File_Download')]
transform: $["x-csharp-buffer-response"] = false;
directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.SourceLeaseId["x-ms-parameter-grouping"];
delete $.DestinationLeaseId["x-ms-parameter-grouping"];