Skip to content

Versioning

The emitter integrates with @typespec/versioning:

import "@typespec/versioning";
using TypeSpec.Versioning;
@versioned(Versions)
namespace MyAPI;
enum Versions {
v1: "1.0.0";
v2: "2.0.0";
}

info.version resolves in this order:

  1. The emitter version option
  2. @apiVersion decorator
  3. The latest @versioned enum value
  4. "1.0.0" (fallback)

When your spec imports a @versioned library, the latest enum value of the importing namespace wins — so a spec that consumes MyLib@v2 emits info.version: 2.0.0 unless overridden.