|
16 | 16 | - [`Record<unkown>` causes `AvoidAdditionalProperties` and `PropertiesTypeObjectNoDefinition`](#recordunkown-causes-avoidadditionalproperties-and-propertiestypeobjectnodefinition) |
17 | 17 | - [`RequestBodyMustExistForPutPatch`](#requestbodymustexistforputpatch) |
18 | 18 | - [`PatchPropertiesCorrespondToPutProperties`](#patchpropertiescorrespondtoputproperties) |
| 19 | + - [`@singleton` causes `EvenSegmentedPathForPutOperation` and `XmsPageableForListCalls`](#singleton-causes-evensegmentedpathforputoperation-and-xmspageableforlistcalls) |
| 20 | + - [`AvoidAnonymousParameter`, `AvoidAnonymousTypes`, `IntegerTypeMustHaveFormat`](#avoidanonymousparameter-avoidanonymoustypes-integertypemusthaveformat) |
| 21 | + - [`AvoidAnonymousTypes` inside a 202 response](#avoidanonymoustypes-inside-a-202-response) |
| 22 | + - [`OAuth2Auth` causes `XmsEnumValidation`](#oauth2auth-causes-xmsenumvalidation) |
19 | 23 | - [`Swagger Avocado`](#swagger-avocado) |
20 | 24 | - [Get help fixing Avocado validation failures](#get-help-fixing-avocado-validation-failures) |
21 | 25 | - [Run avocado locally](#run-avocado-locally) |
@@ -155,21 +159,53 @@ To reproduce LintDiff failures locally, see [CONTRIBUTING.md / How to locally re |
155 | 159 |
|
156 | 160 | ## `Swagger LintDiff` for TypeSpec: troubleshooting guides |
157 | 161 |
|
| 162 | +Check `Swagger LintDiff` may fail for the OpenAPI generated from TypeSpec, even if there are no warnings or errors reported from the TypeSpec compiler. Causes include bugs in the TypeSpec OpenAPI emitter, bugs in LintDiff rules, incompatibilities between TypeSpec and LintDiff, or checks duplicated in TypeSpec and LintDiff. |
| 163 | + |
| 164 | +We are working to address the root causes (where possible). Until then, we recommend you [suppress](#suppression-process) these LintDiff errors, using a "permanent suppression" with a descriptive "reason", so we can revert your suppression when the root cause is fixed. |
| 165 | + |
158 | 166 | ### `Record<unkown>` causes `AvoidAdditionalProperties` and `PropertiesTypeObjectNoDefinition` |
159 | 167 |
|
160 | | -The use of `Record<unkown>` in TypeSpec is discouraged, and there is a TypeSpec lint rule to enforce this. If you still need to use `Record<unknown>`, the OpenAPI spec generated will cause many LintDiff errors of types `AvoidAdditionalProperties` and `PropertiesTypeObjectNoDefinition`. You will need to suppress both the TypeSpec violation (in TypeSpec source code) and the LintDiff violations (in `readme.md`). |
| 168 | +The use of `Record<unkown>` in TypeSpec is discouraged, and there is a TypeSpec lint rule to enforce this. If you still need to use `Record<unknown>`, the OpenAPI spec generated will cause many LintDiff errors of types `AvoidAdditionalProperties` and `PropertiesTypeObjectNoDefinition`. You will need to suppress both the TypeSpec violation (in TypeSpec source code) and the LintDiff violations. |
161 | 169 |
|
162 | 170 | ### `RequestBodyMustExistForPutPatch` |
163 | 171 |
|
164 | | -We believe this is a false positive: https://github.com/Azure/azure-openapi-validator/issues/641. Until fixed, spec authors should **not** suppress the violations in `readme.md`, but rather have label `Approved-LintDiff` applied to their PR to ignore the errors. |
| 172 | +We believe this is a false positive: https://github.com/Azure/azure-openapi-validator/issues/641 |
165 | 173 |
|
166 | 174 | ### `PatchPropertiesCorrespondToPutProperties` |
167 | 175 |
|
168 | | -We believe this is a false positive: https://github.com/Azure/azure-openapi-validator/issues/642. Until fixed, spec authors should **not** suppress the violations in `readme.md`, but rather have label `Approved-LintDiff` applied to their PR to ignore the errors. |
| 176 | +We believe this is a false positive: https://github.com/Azure/azure-openapi-validator/issues/642 |
169 | 177 |
|
170 | 178 | ### `@singleton` causes `EvenSegmentedPathForPutOperation` and `XmsPageableForListCalls` |
171 | 179 |
|
172 | | -If `EvenSegmentedPathForPutOperation` and/or `XmsPageableForListCalls` are failing for OpenAPI generated from TypeSpec using `@singleton` (OpenAPI path ends with `/default`), we believe this is a false positive: https://github.com/Azure/azure-openapi-validator/issues/646. Until fixed, spec authors should **not** suppress the violations in `readme.md`, but rather have label `Approved-LintDiff` applied to their PR to ignore the errors. |
| 180 | +If `EvenSegmentedPathForPutOperation` and/or `XmsPageableForListCalls` are failing for OpenAPI generated from TypeSpec using `@singleton` (OpenAPI path ends with `/default`), we believe this is a false positive: https://github.com/Azure/azure-openapi-validator/issues/646 |
| 181 | + |
| 182 | +### `AvoidAnonymousParameter`, `AvoidAnonymousTypes`, `IntegerTypeMustHaveFormat` |
| 183 | + |
| 184 | +Data-plane specs can suppress violations of the following rules, since they only exist for the benefit of SDKs generated from swagger, and data-plane SDKs are generated directly from TypeSpec. Resource-manager specs should **not** suppress violations of these rules, since resource-manager SDKs are generated from OpenAPI, and rely on these errors being fixed. |
| 185 | + |
| 186 | +* `AvoidAnonymousParameter` |
| 187 | +* `AvoidAnonymousTypes` |
| 188 | +* `IntegerTypeMustHaveFormat` |
| 189 | + |
| 190 | +### `AvoidAnonymousTypes` inside a 202 response |
| 191 | + |
| 192 | +As an exception to the previous note, resource-manager specs **may** be able to suppress `AvoidAnonymousTypes`, but only if the error is inside a 202 response from a long-running operation (LRO). It is known that SDKs do not need to generate type names for such responses. |
| 193 | + |
| 194 | +### `OAuth2Auth` causes `XmsEnumValidation` |
| 195 | + |
| 196 | +TypeSpec using `OAuth2Auth` may generate the following OpenAPI: |
| 197 | + |
| 198 | +``` |
| 199 | +"type": { |
| 200 | + "type": "string", |
| 201 | + "description": "OAuth2 authentication", |
| 202 | + "enum": [ |
| 203 | + "oauth2" |
| 204 | + ] |
| 205 | +}, |
| 206 | +``` |
| 207 | + |
| 208 | +Which causes error `XmsEnumValidation`. The recommended workaround is to add `omit-unreachable-types: true` to your `tspconfig.yaml`. |
173 | 209 |
|
174 | 210 | ## `Swagger Avocado` |
175 | 211 |
|
|
0 commit comments