Azure / Azure/azure-openapi-validator
PATCH operation shouldn't be required for proxy resources with no updatable properties
- Dominant language
- TypeScript
- Stars
- 53
- Forks
- 57
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
For this typespec
```
@armResourceOperations(TaskHub)
interface TaskHubs {
@doc("Get a Task Hub")
get is ArmResourceRead;
@doc("Create or update a Task Hub")
createOrUpdate is ArmResourceCreateOrReplaceSync;
@doc("Delete a Task Hub")
delete is ArmResourceDeleteSync;
@doc("List Task Hubs")
listByParent is ArmResourceListByParent;
}
@doc("An Task Hub resource belonging to the namespace.")
@parentResource(Namespace)
model TaskHub is ProxyResource {
@doc("Task Hub name")
@key("taskHubName")
@pattern("^[a-zA-Z0-9-]{3,64}$")
@segment("taskHubs")
@path
@visibility("read", "create")
name: string;
}
@doc("The properties of Task Hub")
model TaskHubProperties {
@visibility("read")
@doc("The status of the last operation.")
provisioningState?: ProvisioningState;
}
```
Apparently, the linter complains that TaskHub needs a PATCH operation, even though it has no writable properties.
"OpenApi specification document is missing 'PATCH' actions in 'namespaces/taskhubs' resource type. Resource type having 'Default' routing type must have GET, PUT, PATCH, DELETE & LIST operations."
**To Reproduce**
Should be possible to have a minimal repro based on the above or private repo file specification/durabletask/DurableTask.Management/main.tsp
**Expected behavior**
In this case there's no good reason to support PATCH, since there are no mutable properties. And in fact, other linter rules agree, because if you try to add the Update/Patch support, you will get errors about using an empty payload (assuming you take the logical approach of having an empty payload)
**Screenshots**
?
**Desktop (please complete the following information):**
?
**Additional context**
A productivity pain point for teams onboarding new resource types.
Contributor guide
Assessment
This issue has not been assessed yet.