Skip to content

no-uuid

Id
@azure-tools/typespec-azure-resource-manager/no-uuid

ARM APIs should avoid UUID-typed schemas unless they have explicit Azure API review approval.

Avoid UUID-typed schemas in Azure Resource Manager APIs unless their use has explicit Azure API review approval.

  • Area: API, SDK

UUIDs are difficult for customers to create, recognize, and troubleshoot. Prefer stable, human-readable identifiers that follow the resource’s naming constraints. UUID wire types also become language-specific UUID types in generated SDKs, which can make an API harder to use consistently across languages.

The rule checks UUID model properties, HTTP parameters, request and response bodies, response headers, custom scalar aliases, and container types. It also checks UUID formats applied directly with @format("uuid").

@armProviderNamespace
namespace Microsoft.Contoso;
model WidgetProperties {
id: Azure.Core.uuid;
}
@armProviderNamespace
namespace Microsoft.Contoso;
model WidgetProperties {
id: string;
}

If a UUID is required, obtain Azure API review approval and suppress the rule at the authored declaration with the approval context.

This rule corresponds to the Swagger validator rule GuidUsage.