Adding a Preview Version when the Last Version was Stable
When the latest api-version in your TypeSpec spec is a stable version, adding a new preview version is simply adding any new types and operations in the new preview and marking them with the appropriate versioning decoration, as described in TypeSpec Versioning for Azure ResourceManager APIs.
Making Changes to your TypeSpec spec
Section titled “Making Changes to your TypeSpec spec”-
Add a new version to the
Versionsenum in your spec for the new preview.enum Versions {`2025-10-01`,`2026-01-01-preview`,} -
Decorate this version with the
@previewVersiondecorator from theAzure.Corelibraryenum Versions {`2025-10-01`,@Azure.Core.previewVersion`2026-01-01-preview`,} -
Make changes to the API description based on how the API has changed
-
If any types are removed in the new preview (unlikely) mark these with an
@removeddecorator referencing the new version@removed(Versions.`2026-01-01-preview`)model Foo {} -
If any types are added, renamed, or otherwise modified in the new version, mark them with the appropriate versioning decorator
@added(Versions.`2026-01-01-preview`)model Foo {}@renamedFrom(Versions.`2026-01-01-preview`, "Bar")model Bar {}model Baz {}
-
-
Create a new examples folder for the new version
examples\<version>and populate it with examples.
Preparing a PR into the azure-rest-api-specs repo
Section titled “Preparing a PR into the azure-rest-api-specs repo”-
Navigate to the root directory of the repo in your local fork or clone
Terminal window C:\repos\azure-rest-api-specs\specifications\myRp > cd \repos\azure-rest-api-specsC:\repos\azure-rest-api-specs > -
Pull the latest version from the repo
Terminal window C:\repos\azure-rest-api-specs > git fetch upstream mainC:\repos\azure-rest-api-specs > git pull upstream main -
Reinstall dependencies
Terminal window C:\repos\azure-rest-api-specs > npm ci -
Compile your spec
Terminal window C:\repos\azure-rest-api-specs > cd specification\myRpShortname\resource-manager\Microsoft.MyRP\MyServiceC:\repos\azure-rest-api-specs\specification\myRpShortname\resource-manager\Microsoft.MyRP\MyService > npx tsp compile .- Update README.md to include a new entry for the new preview version.