require-versioned
@azure-tools/typespec-azure-core/require-versionedAzure services should use the versioning library.
Azure services should always use the versioning library even if they have a single version. This ensures that the service is ready for future versions and generate the OpenAPI 2.0 in the correct location.
Impact
Section titled “Impact”- Area: API, SDK
Without versioning, the API cannot be updated with new api-versions.
❌ Incorrect
Section titled “❌ Incorrect”@servicenamespace Azure.MyService;@service(#{ version: "2021-01-01" })namespace Azure.MyService;@service@OpenAPI.info({ version: "2021-01-01",})namespace Azure.MyService;✅ Correct
Section titled “✅ Correct”@versioned(Versions)@servicenamespace Azure.MyService;
enum Versions { 2021_01_01: "2021-01-01",}Suppression
Section titled “Suppression”Do not suppress. Add a Versions enum and reference it from the @versioned decorator on the root namespace.