Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lint rule R4005,R4006 to guidelines doc #8770

Merged
merged 7 commits into from
Apr 1, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions documentation/openapi-authoring-automated-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ We request OpenAPI(Swagger) spec authoring be assigned to engineers who have an
| [R3028](#r3028) | [TrackedResourceListBySubscription](#r3028) | ARM OpenAPI(swagger) specs |
| [R3011](#r3011) | [DescriptionMustNotBeNodeName](#r3011) | ARM and Data plane OpenAPI(swagger) specs |
| [R2020](#r2020) | [RequiredPropertiesMissingInResourceModel](#r2020) | ARM OpenAPI(swagger) specs |
| [R4005](#r4005) | [UniqueXmsEnumName](#r4005) | ARM and Data plane OpenAPI(swagger) specs |

#### ARM Warnings

Expand All @@ -66,6 +67,7 @@ We request OpenAPI(Swagger) spec authoring be assigned to engineers who have an
| [R3015](#r3015) | [EnumMustHaveType](#r3015) | ARM OpenAPI(swagger) specs |
| [R3024](#r3024) | [EnumUniqueValue](#r3024) | ARM OpenAPI(swagger) specs |
| [R3029](#r3029) | [EnumMustNotHaveEmptyValue](#r3024) | ARM OpenAPI(swagger) specs |
| [R4006](#r4006) | [DeprecatedXmsCodeGenerationSetting](#r4006) | ARM and Data plane OpenAPI(swagger) specs |

### SDK Violations

Expand Down Expand Up @@ -1914,6 +1916,8 @@ Links: [Index](#index) | [Error vs. Warning](#error-vs-warning) | [Automated Rul

**How to fix the violation**: Add the right operationId for each operation

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)

### <a name="r3020" ></a>R3020 PathResourceProviderNamePascalCase

**Category** : ARM Warning
Expand Down Expand Up @@ -2234,3 +2238,83 @@ Eg:
```

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)

### <a name="r4005" ></a>R4005 UniqueXmsEnumName

**Category** : ARM Error

**Applies to** : ARM and Data plane OpenAPI(swagger) specs
jianyexi marked this conversation as resolved.
Show resolved Hide resolved

**Output Message** : Must not have duplicate name in x-ms-enum extension , make sure every x-ms-enum name unique.
jianyexi marked this conversation as resolved.
Show resolved Hide resolved

**Description** : Property name in x-ms-extension is required , the rule introduced to avoid duplicate x-ms-enum name.
jianyexi marked this conversation as resolved.
Show resolved Hide resolved

**CreatedAt**: March 18, 2020

**LastModifiedAt**: March 18, 2020

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

The following would be invalid:
```json
"State": {
"description": "The state of the configuration store.",
"enum": [
"Failed",
"Canceled"
],
"type": "string",
"readOnly": true,
"x-ms-enum": {
"name": "DuplicateName",
"modelAsString": true
}
},
"status": {
"description": "The state code.",
"enum": [
"Success",
"FAILED"
],
"readOnly": true,
"type": "string",
"x-ms-enum": {
"name": "DuplicateName",
"modelAsString": true
}
}
}
```

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)

### <a name="r4006" ></a>R4006 DeprecatedXmsCodeGenerationSetting

**Category** : ARM Warning

**Applies to** : ARM and Data plane OpenAPI(swagger) specs

**Output Message** : The x-ms-code-generation-setting extension is being deprecated. Please remove it and move settings to readme file for code generation.

**Description** : x-ms-code-generation-settings is being deprecated. AutoRest (v3) will stop supporting it inside the Swagger. There was Readme.md to hold the same configuration options. Please ensure to remove the parameter from swagger spec and move settings to readme.
jianyexi marked this conversation as resolved.
Show resolved Hide resolved

**CreatedAt**: March 18, 2020

**LastModifiedAt**: March 18, 2020

**How to fix the violation**: Since the only value of this extension today is to override the client name, which could be done with a “title” line in the Readme,you could remove the extension from swagger spec and move settings to readme.
jianyexi marked this conversation as resolved.
Show resolved Hide resolved

jianyexi marked this conversation as resolved.
Show resolved Hide resolved
The following would be invalid:

```json
"info": {
"version": "2016-05-16",
"x-ms-code-generation-settings": {
"name": "AnalysisServicesManagementClient"
}
}
```

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)