Azure / Azure/typespec-azure

Add linting rule to validate ops in arm interface are all for the same resource

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

Description

So in general, we would like to establish a standard in new management typespec that the operations belong to the same resource, should come in one same interface, such as:
```
interface VirtualMachines
{
get is ArmResourceRead;
createOrUpdate is ArmResourceCreateOrUpdate;
}
```
and we should be trying to avoid this case:
```
interface VirtualMachines
{
get is ArmResourceRead;
createOrUpdate is ArmResourceCreateOrUpdate; // this should go to its own interface `VirtualMachineScaleSets`
}
```

Therefore could we add some validations in the decorator `@armResourceOperations(Model)` to let it validate if all the operations in the same interface to have the same `Resource` argument?

Contributor guide

Open the contributing guide

Research direction

Start at the @armResourceOperations(Model) decorator and trace how its current validations inspect operations in an interface. Define done as reporting a validation failure when operations use different Resource arguments, while allowing operations that target the same resource; the issue provides the expected valid and invalid interface examples.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.