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** : 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