You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Output Message** : [RPaaS] Only 201 is the supported response code for PUT async response
2931
2936
2932
-
**Description** : An async PUT operation response include status code 201 with Azure-async-operation header. Must also support status code 200, for simple updates that can be completed synchronously (ex: tags). Operation must also add "x-ms-long-running-operation and x-ms-long-running-operation-options" to describe how the long running operation is tracked.
2937
+
**Description** : An async PUT operation response include status code 201 with 'Azure-async-operation' header. Must also support status code 200, for simple updates that can be completed synchronously (ex: tags). Operation must also add "x-ms-long-running-operation and x-ms-long-running-operation-options" to mark that it is a long running operation (in case of 201) and how it is tracked (Azure-async-operation header).
2933
2938
2934
2939
**CreatedAt**: August 10, 2020
2935
2940
2936
2941
**LastModifiedAt**: August 10, 2020
2937
2942
2938
-
**Why this rule is important**: RPaaS only supports 201 for async operations. This is enforced at runtime via swagger validation.
2943
+
**Why this rule is important**: RPaaS only supports 201 for async PUT operations. This is enforced at runtime via swagger validation.
2939
2944
2940
2945
**How to fix the violation**: Add the following for async PUT operations.
**Description** : An async DELETE operation response include status code 202 with 'Location' header. Must support status code 200 if operation can be completed synchronously. Must support 204 (resource doesn't exists). Operation must also add "x-ms-long-running-operation and x-ms-long-running-operation-options" to mark that it is a long running operation (in case of 202) and how it is tracked (Location header).
3007
+
3008
+
**CreatedAt**: November 12, 2020
3009
+
3010
+
**LastModifiedAt**: November 12, 2020
3011
+
3012
+
**Why this rule is important**: RPaaS only supports 202 for async DELETE operations. This is enforced at runtime via swagger validation.
3013
+
3014
+
**How to fix the violation**: Add the following for async DELETE operations.
**Description** : An async POST operation response include status code 202 with 'Location' header. Must support status code 200 if operation can be completed synchronously. Operation must also add "x-ms-long-running-operation and x-ms-long-running-operation-options" to mark that it is a long running operation (in case of 202) and how it is tracked (Location header).
3054
+
3055
+
**CreatedAt**: November 12, 2020
3056
+
3057
+
**LastModifiedAt**: November 12, 2020
3058
+
3059
+
**Why this rule is important**: RPaaS only supports 202 for async POST operations. This is enforced at runtime via swagger validation.
3060
+
3061
+
**How to fix the violation**: Add the following for async POST operations.
3062
+
3063
+
The following would be valid:
3064
+
3065
+
```json
3066
+
...
3067
+
"responses": {
3068
+
"202": {
3069
+
"description": "Operation accepted",
3070
+
},
3071
+
"200": {
3072
+
"description": "Operation completed"
3073
+
},
3074
+
"default": {
3075
+
"description": "Error response describing why the operation failed.",
3076
+
"schema": {
3077
+
"$ref": "#/definitions/ErrorResponse"
3078
+
}
3079
+
}
3080
+
},
3081
+
"x-ms-long-running-operation": true,
3082
+
"x-ms-long-running-operation-options": {
3083
+
"final-state-via": "location"
3084
+
}
3085
+
...
3086
+
```
3087
+
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)
**Output Message** : There is no declared valid status code.
3096
+
3097
+
**Description** : Every operation response must contain a valid code like "200","201","202" or "204" which indicates the operation is succeed and it's not allowed that a response schema just contains a "default" code.
3098
+
3099
+
**Why this rule is important**: If a Swagger just contains "default" status code, this actually means "everything is an error". All track2 SDK will systematically raise an exception at runtime, if there is no declared valid status code.
3100
+
3101
+
**CreatedAt**: November 23, 2020
3102
+
3103
+
**LastModifiedAt**: November 23, 2020
3104
+
3105
+
**How to fix the violation**: Add a valid response code .
3106
+
The following would be valid:
3107
+
3108
+
```json
3109
+
...
3110
+
"responses": {
3111
+
"200": {
3112
+
"description": "Succeeded",
3113
+
"schema": {
3114
+
"$ref": "#/definitions/MySimpleResource"
3115
+
}
3116
+
},
3117
+
"default": {
3118
+
"description": "Error response describing why the operation failed.",
3119
+
"schema": {
3120
+
"$ref": "#/definitions/ErrorResponse"
3121
+
}
3122
+
}
3123
+
}
3124
+
}
3125
+
...
3126
+
```
3127
+
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)
**Output Message** : Do not have duplicate name of client parameter name, make sure every client parameter name unique.
3136
+
3137
+
**Description** : This may cause a problem when different swagger files come together. If two APIs with different client name have the same client parameter subscriptionId, but with different reference name in swaggers, the generated model will also have two clients with two client parameters subscriptionId and subscriptionId1 (the latter one has been renamed to avoid collision). We should ensure that the client parameters are all unique in the same API version.
3138
+
3139
+
**Why this rule is important**: Make sure no conflict in SDK generation.
3140
+
3141
+
**CreatedAt**: November 30, 2020
3142
+
3143
+
**LastModifiedAt**: November 30, 2020
3144
+
3145
+
**How to fix the violation**: Remove duplicate client parameter, ref to the same one.
3146
+
The following would be valid:
3147
+
3148
+
```json
3149
+
...
3150
+
"/api": {
3151
+
"get": {
3152
+
"parameters": [
3153
+
{
3154
+
"$ref": "#/parameters/ApiVersionParameter"
3155
+
},
3156
+
{
3157
+
// ref to the same subcriptionId
3158
+
"$ref": "#/parameters/subscriptionIdParameter"
3159
+
},
3160
+
],
3161
+
},
3162
+
"patch": [
3163
+
{
3164
+
"$ref": "#/parameters/ApiVersionParameter"
3165
+
},
3166
+
{
3167
+
"$ref": "#/parameters/subscriptionIdParameter"
3168
+
},
3169
+
]
3170
+
}
3171
+
...
3172
+
```
3173
+
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)
3174
+
3175
+
### <a name="r4030" ></a>R4030 UniqueXmsExample
3176
+
3177
+
**Category** : SDK Warning
3178
+
3179
+
**Applies to** : ARM OpenAPI(swagger) specs
3180
+
3181
+
**Output Message** : Do not have duplicate name of x-ms-example, make sure every x-ms-example name unique. Duplicate x-ms-example: {ExampleName}
3182
+
3183
+
**Description** : x-ms-example name should be unique in the same API version.
3184
+
3185
+
**Why this rule is important**: Duplicate example name will bring trouble for test codegen. For example: hard to config used example.
3186
+
3187
+
**CreatedAt**: November 30, 2020
3188
+
3189
+
**LastModifiedAt**: November 30, 2020
3190
+
3191
+
**How to fix the violation**: Rename duplicate x-ms-example name
3192
+
The following would be valid:
3193
+
3194
+
```json
3195
+
...
3196
+
"x-ms-examples": {
3197
+
"Create resource": {
3198
+
"$ref": "./examples/createResource"
3199
+
},
3200
+
"Update resource":{
3201
+
"$ref": "./examples/updateResource"
3202
+
}
3203
+
3204
+
}
3205
+
...
3206
+
```
3207
+
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