Skip to content

Commit 425c8fe

Browse files
jianyexijianye xi
andauthored
add rpaas lint rule R4031 doc & update R4005 (Azure#12268)
* update lint rule documentation for R4009&R2005 * add r4031 * improve * Update openapi-authoring-automated-guidelines.md * improve R4005 * up * up * up * up Co-authored-by: jianye xi <[email protected]>
1 parent 10f3923 commit 425c8fe

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

documentation/openapi-authoring-automated-guidelines.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ We request OpenAPI(Swagger) spec authoring be assigned to engineers who have an
155155
| [R4023](#r4023) | [RPaasPutLongRunningOperation201Only](#r4023) | ARM OpenAPI(swagger) specs |
156156
| [R4025](#r4025) | [RPaasDeleteLongRunningOperation202Only](#r4025) | ARM OpenAPI(swagger) specs |
157157
| [R4026](#r4026) | [RPaasPostLongRunningOperation202Only](#r4026) | ARM OpenAPI(swagger) specs |
158-
158+
| [R4031](#r4031) | [RPaasResourceProvisioningState](#r4031) | ARM OpenAPI(swagger) specs |
159159
### Documentation
160160

161161
#### Documentation Errors
@@ -2270,10 +2270,15 @@ Links: [Index](#index) | [Error vs. Warning](#error-vs-warning) | [Automated Rul
22702270
**Output Message** : Must not have duplicate name in x-ms-enum extension , make sure every x-ms-enum name unique.
22712271

22722272
**Description** : This rule will check all the swagger files with the same api-version, and ensure there is no duplicate x-ms-enum name.
2273+
The following cases are deemed as violation:
2274+
1. if two enums have the same x-ms-enum name , but types are different.
2275+
2. if two enums have the same x-ms-enum name , but 'modelAsString' are different.
2276+
3. if two enums have the same x-ms-enum name , but include different values.
2277+
4. if two enums have the same x-ms-enum name and 'modelAsString' is false , but enums' values have different order.
22732278

22742279
**CreatedAt**: March 18, 2020
22752280

2276-
**LastModifiedAt**: March 18, 2020
2281+
**LastModifiedAt**: January 14, 2021
22772282

22782283
**How to fix the violation**: Update the duplicate x-ms-enum name :
22792284

@@ -3213,3 +3218,45 @@ The following would be valid:
32133218
...
32143219
```
32153220
Links: [Index](#index) | [Error vs. Warning](#error-vs-warning) | [Automated Rules](#automated-rules) | [ARM](#arm-violations): [Errors](#arm-errors) or [Warnings](#arm-warnings) | [SDK](#sdk-violations): [Errors](#sdk-errors) or [Warnings](#sdk-warnings)
3221+
3222+
### <a name="r4031"></a>R4031 RPaasResourceProvisioningState
3223+
3224+
**Category** : RPaaS Error
3225+
3226+
**Applies to** : ARM OpenAPI(swagger) specs
3227+
3228+
**Output Message** : [RPaaS] The resource {0} is defined without 'provisioningState' in properties bag, consider adding the provisioningState for it.
3229+
3230+
**Description** : Verifies if a Azure resource has a corresponding 'provisioningState' property. If the 'provisioningState' is not defining explicitly , the client will drop the state when the service does return it.
3231+
3232+
**CreatedAt**: January 15, 2021
3233+
3234+
**LastModifiedAt**: January 15, 2021
3235+
3236+
**Why this rule is important**: Per [Azure RPC](https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property), all Azure resources must support "provisioningState" property.
3237+
3238+
**How to fix the violation**: Add the 'provisioningState' for every Azure resource.
3239+
3240+
The following would be valid:
3241+
3242+
```json
3243+
...
3244+
resourceDefinition": {
3245+
"description": "resource definition",
3246+
"type": "object",
3247+
"properties": {
3248+
"properties": {
3249+
"type": "object",
3250+
"properties" :{
3251+
"provisioningState": {
3252+
"type": "string",
3253+
"readOnly": true
3254+
}
3255+
...
3256+
}
3257+
}
3258+
}
3259+
}
3260+
...
3261+
```
3262+
Links: [Index](#index) | [Error vs. Warning](#error-vs-warning) | [Automated Rules](#automated-rules) | [ARM](#arm-violations): [Errors](#arm-errors) or [Warnings](#arm-warnings) | [SDK](#sdk-violations): [Errors](#sdk-errors) or [Warnings](#sdk-warnings)

0 commit comments

Comments
 (0)