Azure / Azure/azure-openapi-validator
getAllResourceProvidersFromPath doesn't work when people put a leading '/' in front of a resource scope parameter (extension scenario)
- Dominant language
- TypeScript
- Stars
- 53
- Forks
- 57
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
In PRs, people are adding suppressions because getAllResourceProvidersFromPath treats the following path declarations differently:
`/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default`
`{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default`
with difference in leading slash.
leading to (possibly misleading) suppressions like:
```
directive:
- suppress: R3020
from:
@@ -64,14 +64,30 @@ suppressions:
reason: The linter is mistakenly thinking that paths for a singular resource that is always named default, like "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default," is for a collection of resources.
```
**To Reproduce**
Test with both
`/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default`
`{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default`
**Expected behavior**
getAllResourceProvidersFromPath needs to see the provider name is Microsoft.AzureStackHCI but apparently its confused about that
**Screenshots**
**Desktop (please complete the following information):**
N/A
**Additional context**
See e.g. PR
https://github.com/Azure/azure-rest-api-specs/pull/25555/files#diff-252e313698c479b4ea491ad65d7bb1f75ccfe83aab3f773ee5bf100b1bb0a0c9
if more context on the specific API is needed
Contributor guide
Assessment
This issue has not been assessed yet.