Skip to content

January 2023

See TypeSpec Core release notes

Prior to the January 2023 release, Azure.Core lifecycle operations were customized using a TCustom template parameter which expected a parameters and/or response property which indicates the customizations to be applied for that operation.

In this release, we have changed to a new Service Traits design which is more flexible and enables customizations for individual operations as well as all operations across an entire service specification.

Documentation and additional details can be found in this page of the Azure.Core documentation:

https://azure.github.io/typespec-azure/docs/getstarted/azure-core/step09

If you have previously been customizing operation parameters using the parameters field of TCustom, you should now use either QueryParametersTrait or RequestHeadersTrait. If you were customizing response headers with the response field of TCustom, you should now use ResponseHeadersTrait for customization.

The documentation link above explains how to use these trait types.

The @collectionFormat decorator in @azure-tools/typespec-autorest is deprecated in favor of a new ā€˜format’ option in the @query and @header decorators. Note that ā€œcsvā€ is the new default format for representing array types in headers, while ā€œmultiā€ is the default format for representing array types in query parameters.

For example

model Widget {
@collectionFormat("multi")
@query
colors: string[];
@collectionFormat("csv")
@header("x-ms-flanges")
flanges: string[];
}

should be changed to

model Widget {
@query({
format: "multi",
})
colors: string[];
@header({
name: "x-ms-flanges",
format: "csv",
})
flanges: string[];
}

or, taking advantage of the default format for headers and query parameters

model Widget {
@query colors: string[];
@header("x-ms-flanges") flanges: string[];
}