Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
taklei1 committed May 3, 2020
2 parents 4138ee4 + a07634d commit f0fb1c0
Show file tree
Hide file tree
Showing 84 changed files with 2,437 additions and 713 deletions.
16 changes: 0 additions & 16 deletions .github/assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,5 @@
paths:
- "**"
reviewers:
- yungezz
- zikalino
- erich-wang
- NullMDR
- raych1
- lirenhe
- weidongxu-microsoft
- ArcturusZhang
- xccc-msft
- ChenTanyi
- fengzhou-msft
- njuCZ
- akning-ms
- markcowl
- leni-msft
- qianwens
- allenjzhang
- ruowan
1 change: 1 addition & 0 deletions custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,7 @@ testallroutes
testnew
testnewroute
textanalytics
TFIDF
Tful
Tfvc
timeframe
Expand Down
41 changes: 41 additions & 0 deletions documentation/FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# FAQ in Swagger PR Review

This page is intended to answer questions frequently asked during Azure Swagger PR review.

1. [I am new to Swagger/OpenAPI, How should I start?](#Onboard)
2. [How to fix validation failure?](#validation)
3. [How to generate SDK from Swagger?](#SDK)
4. [How to generate document](#doc)
5. [If need further help, who can we contact?](#contact)

## How to onboard PR review Process?<a name="Onboard"></a>
If you are new to Swagger/OpenAPI, you can refer to this [document](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/80/Getting-started-with-OpenAPI-specifications)

If you are new to Swagger PR review process, you can refer to this [flowchart](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/212/Swagger-PR-Review)

You can refer to this [document](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/49/Request-Access-to-Azure-SDK-repos) to get read permission to submit PR.

## How to fix validation failure?<a name="validation"></a>
| Validation | Description | How to fix |
| --- | --- | --- |
| [Model Validation](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/Semantic-and-Model-Violations-Reference.md) | Model validation enforces correctness between example and swagger. It checks whether definitions for request parameters and responses, match an expected input/output payload of the service. | [Here](https://aka.ms/ci-fix#model-validation) |
| [Lint diff](https://github.com/Azure/azure-openapi-validator) | A tool to check whether changes in PR are satisfied with certain kind of rules outlined in the [automated rules checklist](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md) | [Here](https://aka.ms/ci-fix#linter-validation) |
| [Breaking Change](https://github.com/Azure/openapi-diff) | A tool to check what a swagger PR has changed and whether these changes violate [breaking changes rules](https://github.com/Azure/openapi-diff/blob/master/docs/README.md).| [Here](https://aka.ms/ci-fix#breaking-change-check)|
| [Avocado](https://github.com/Azure/avocado/blob/master/README.md) | Avocado validates folder structure and configuration. | [Here](https://aka.ms/ci-fix#avocado) |
| [Semantic](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/Semantic-and-Model-Violations-Reference.md) | Semantic validation enforces correctness on the swagger specific elements. Such as paths and operations. Ensure the element definition meet the OpenApi 2.0 specification. | [Here](https://aka.ms/ci-fix#semantic-validation) |
| Prettier | Code formatter for Swagger | [Here](https://aka.ms/ci-fix#prettier-check) |
| BranchProtectionForPrivateRepo | BranchProtectionForPrivateRepo is designed to always fail to prevent from merging PR into master which is not allow in private swagger repo as it will cause issue to sync up from public repo. | You can ignore this failure |

Refer to [Document](https://aka.ms/ci-fix) for how to run these tools locally

## How to generate SDK from Swagger?<a name="SDK"></a>
If you are working in the public repository,SDK generation is triggered as soon as your OpenAPI specification (a.k.a swagger) PR is created/committed/merged in to the azure-rest-api-specs repository.

If you are working in the private repository, please refer to this [document](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/81/Management-Plane-SDK-generation) to manually generate SDKs of different languages, including Python, Java, Go, C#, Js etc.


## How to generate Document from Swagger?<a name="doc"></a>
Refer to [document](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/79/Generation-of-docs-on-docs.microsoft.com)

## If need further help, who can we contact?<a name="contact"></a>
If any other help need, Please send a mail to [email protected]
78 changes: 78 additions & 0 deletions documentation/openapi-authoring-automated-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ We request OpenAPI(Swagger) spec authoring be assigned to engineers who have an
| [R3020](#r3020) | [PathResourceProviderNamePascalCase](#r3020) | ARM OpenAPI(swagger) specs |
| [R3021](#r3021) | [PathResouceTypeNameCamelCase](#r3021) | ARM OpenAPI(swagger) specs |
| [R4004](#r4004) | [OperationIdRequired](#r4004) | ARM OpenAPI(swagger) specs |
| [R4007](#r4007) | [DefaultErrorResponseSchema](#r4007) | ARM OpenAPI(swagger) specs |

#### ARM Warnings

Expand Down Expand Up @@ -97,6 +98,7 @@ We request OpenAPI(Swagger) spec authoring be assigned to engineers who have an
| [R3024](#r3024) | [EnumUniqueValue](#r3024) | ARM and Data plan OpenAPI(swagger) specs |
| [R3029](#r3029) | [EnumMustNotHaveEmptyValue](#r3024) | ARM and Data plan OpenAPI(swagger) specs |
| [R4005](#r4005) | [UniqueXmsEnumName](#r4005) | ARM and Data plane OpenAPI(swagger) specs |
| [R4008](#r4008) | [AvoidEmptyResponseSchema](#r4008) | ARM OpenAPI(swagger) specs |

#### SDK Warnings

Expand Down Expand Up @@ -2315,4 +2317,80 @@ The following would be invalid:

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="r4007" ></a>R4007 DefaultErrorResponseSchema

**Category** : ARM Error

**Applies to** : ARM OpenAPI(swagger) specs

**Output Message** : The default error response schema SHOULD correspond to the schema documented at https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-details.md#error-response-content.

**Description** : The default error response schema SHOULD correspond to the schema documented at [common-api-details](https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-details.md#error-response-content).

**CreatedAt**: April 2, 2020

**LastModifiedAt**: April 2, 2020

**How to fix the violation**: Following the ARM specification to modify the schema in the swagger file.

The following would be invalid:

```json
"responese":{
"default": {
"schema":{
"error":"error msg",
"code": 404,
"message":"some details"
}
}
}

```

the correct schema:

```json
"responese":{
"default": {
"error":
{
"code": 404,
"message":"some details"
...
}
}
}

```

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="r4008" ></a>R4008 AvoidEmptyResponseSchema

**Category** : SDK Error

**Applies to** : ARM OpenAPI(swagger) specs

**Output Message** : Response schema must not be empty.

**Description** : Response schema must not be empty, or it will block code genaration.

**CreatedAt**: April 2, 2020

**LastModifiedAt**: April 2, 2020

**How to fix the violation**: Add the correct definition of the schema in the response or remove it if don't need.

The following would be invalid:

```json
...
"responese":{
"default": {
"schema":{
}
}
}
...
```
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,26 @@
"encryption": {
"$ref": "#/definitions/EncryptionProperties",
"description": "The encryption settings of the configuration store."
},
"privateEndpointConnections": {
"description": "The list of private endpoint connections that are set up for this resource.",
"type": "array",
"readOnly": true,
"items": {
"$ref": "#/definitions/PrivateEndpointConnectionReference"
}
},
"publicNetworkAccess": {
"description": "Control permission for data plane traffic coming from public networks while private endpoint is enabled.",
"enum": [
"Enabled",
"Disabled"
],
"type": "string",
"x-ms-enum": {
"name": "PublicNetworkAccess",
"modelAsString": true
}
}
}
},
Expand All @@ -952,6 +972,32 @@
}
}
},
"PrivateEndpointConnectionReference": {
"type": "object",
"description": "A reference to a related private endpoint connection.",
"properties": {
"id": {
"description": "The resource ID.",
"type": "string",
"readOnly": true
},
"name": {
"description": "The name of the resource.",
"type": "string",
"readOnly": true
},
"type": {
"description": "The type of the resource.",
"type": "string",
"readOnly": true
},
"properties": {
"$ref": "#/definitions/PrivateEndpointConnectionProperties",
"description": "The properties of a private endpoint connection.",
"x-ms-client-flatten": true
}
}
},
"KeyVaultProperties": {
"type": "object",
"description": "Settings concerning key vault encryption for a configuration store.",
Expand Down Expand Up @@ -1534,6 +1580,14 @@
"type": "string"
},
"readOnly": true
},
"requiredZoneNames": {
"type": "array",
"items": {
"type": "string"
},
"readOnly": true,
"description": "The list of required DNS zone names of the private link resource."
}
},
"description": "Properties of a private link resource."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand All @@ -52,7 +54,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down Expand Up @@ -69,7 +71,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand All @@ -44,7 +46,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand All @@ -40,7 +42,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand All @@ -51,7 +53,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down Expand Up @@ -68,7 +70,9 @@
"keyIdentifier": null,
"identityClientId": null
}
}
},
"privateEndpointConnections": [],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "Standard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"groupId": "configurationStores",
"requiredMembers": [
"configurationStores"
],
"requiredZoneNames": [
"privatelink.azconfig.io"
]
}
}
Expand Down
Loading

0 comments on commit f0fb1c0

Please sign in to comment.