-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add QueryParametersInCollectionGet linter rule (#745)
* Add QueryParametersInCollectionGet linter rule * Update logic to figure out list op paths * Add staging only * Address comments --------- Co-authored-by: akhilailla <akhilailla@microsoft.com>
- Loading branch information
1 parent
a19b89c
commit a954384
Showing
9 changed files
with
725 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# QueryParametersInCollectionGet | ||
|
||
## Category | ||
|
||
ARM Error | ||
|
||
## Applies to | ||
|
||
ARM OpenAPI(swagger) specs | ||
|
||
## Related ARM Guideline Code | ||
|
||
- RPC-Get-V1-15 | ||
|
||
## Description | ||
|
||
Collection Get's/List operations MUST not have query parameters other than api-version & OData filter. | ||
|
||
## How to fix the violation | ||
|
||
Ensure that collection GET/List operations do not include any query parameters other than api-version and the OData $filter. | ||
|
||
## Good Examples | ||
|
||
```json | ||
"Microsoft.Music/Songs": { | ||
"get": { | ||
"operationId": "Foo_Update", | ||
"description": "Test Description", | ||
"parameters": [ | ||
{ | ||
"name": "api-version", | ||
"in": "query" | ||
}, | ||
], | ||
}, | ||
}, | ||
``` | ||
|
||
```json | ||
"Microsoft.Music/Songs": { | ||
"get": { | ||
"operationId": "Foo_Update", | ||
"description": "Test Description", | ||
"parameters": [ | ||
{ | ||
"name": "api-version", | ||
"in": "query" | ||
}, | ||
{ | ||
"name": "$filter", | ||
"in": "query", | ||
"required": false, | ||
"type": "string", | ||
}, | ||
], | ||
}, | ||
}, | ||
``` | ||
|
||
## Bad Examples | ||
|
||
```json | ||
"Microsoft.Music/Songs": { | ||
"get": { | ||
"operationId": "Foo_Update", | ||
"description": "Test Description", | ||
"parameters": [ | ||
{ | ||
"name": "name", | ||
"in": "query", | ||
"required": false, | ||
"type": "string", | ||
}, | ||
], | ||
}, | ||
}, | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.