no-explicit-routes-resource-ops
@azure-tools/typespec-azure-core/no-explicit-routes-resource-opsThe @route decorator should not be used on standard resource operation signatures. Standard resource operations already have well-defined routes. If you need to add a route prefix, use @route on an interface or namespace instead.
โ Incorrect
Section titled โโ IncorrectโUsing @route directly on resource operations:
@resource("widgets")model Widget { @key name: string;}
@route("/api/widgets/{name}")op readWidget is Azure.Core.StandardResourceOperations.ResourceRead<Widget>;
@route("/api/widgets")op listWidgets is Azure.Core.StandardResourceOperations.ResourceList<Widget>;โ Correct
Section titled โโ CorrectโLet standard resource operations define their own routes:
@resource("widgets")model Widget { @key name: string;}
// route: /widgets/{name}op readWidget is Azure.Core.StandardResourceOperations.ResourceRead<Widget>;// route: /widgetsop listWidgets is Azure.Core.StandardResourceOperations.ResourceList<Widget>;