Skip to content

no-rest-library-interfaces

Id
@azure-tools/typespec-azure-core/no-rest-library-interfaces

Resource interfaces from the TypeSpec.Rest.Resource library are incompatible with Azure.Core.

Resource interfaces from the TypeSpec.Rest.Resource library are incompatible with Azure.Core. Use the Azure.Core resource operation patterns instead.

  • Area: SDK, Emitters

Describing resource APIs with raw REST-library interfaces can prevent emitters from recognizing them as resources, though that usually surfaces as other violations too.

Extending from TypeSpec.Rest.Resource.ResourceOperations:

interface Widgets
extends TypeSpec.Rest.Resource.ResourceOperations<Widget, Foundations.ErrorResponse> {}

Define a custom interface using Azure.Core operations:

interface MyResourceOperations<TResource extends TypeSpec.Reflection.Model> {
read is ResourceRead<TResource>;
}
interface Widgets extends MyResourceOperations<Widget> {}

Suppression is acceptable when there are no other related violations; otherwise use the standard operation templates.