Azure / Azure/typespec-azure

[resource-manager] we should disallow people to use `Parameters` to add more path parameters for CRUD operations

Open
#3,556 0 comments 0 reactions 0 assignees View on GitHub
feature lib:azure-resource-manager triaged:core
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

We have some templates to define CRUD operations of a resource, for example we could do:
```
interface Employees {
get is Extension.Read;
}
```
but if they do this:
```
interface Employees {
get is Extension.Read<
Extension.ManagementGroup,
Employee,
Parameters = {
@path
@segment("pays")
payName: string;
}>;
}
```
they actually defined a child resource under the this resource `Employee`, which makes the hierarchy of resources incorrect.

I think as resource's CRUD methods, we should disallow people to add path parameters to them.

Also in some scenarios, they misuse the template, for instance: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/quota/resource-manager/Microsoft.Quota/Quota/GroupQuotasEntity.tsp#L155
this is a list operation returning pageable results, but its uri has even segments. This should be an action instead of `Read`.

Contributor guide

Open the contributing guide

Research direction

Start by locating the resource-manager CRUD templates, especially Extension.Read, and review the GroupQuotasEntity.tsp example linked in the issue. Determine how CRUD templates distinguish child-resource paths from actions, then add coverage showing that path Parameters are rejected for CRUD operations and that the cited even-segment list operation is not accepted as Read.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.