From bfbbca417537b86565c1f0434f6b0e34d0601811 Mon Sep 17 00:00:00 2001 From: JianyeXi <59603451+jianyexi@users.noreply.github.com> Date: Sat, 20 Feb 2021 15:23:08 +0800 Subject: [PATCH] Update ci-fix (#13050) * add sdk track2 validation * update Co-authored-by: jianye xi --- documentation/ci-fix.md | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/documentation/ci-fix.md b/documentation/ci-fix.md index 0b7f19f04051..32901b31f3e4 100644 --- a/documentation/ci-fix.md +++ b/documentation/ci-fix.md @@ -60,14 +60,21 @@ Refer to [Oad Docs](https://github.com/Azure/openapi-diff/tree/master/docs) for ## Linter Validation -Run linter locally: -``` +### Run linter locally: + +#### Prerequisites: npm install -g autorest + +#### Given a swagger spec, run linter: +``` autorest --validation --azure-validator --use=@microsoft.azure/classic-openapi-validator@latest --use=@microsoft.azure/openapi-validator@latest --input-file= -or +``` +#### Given a readme file, run linter: +``` autorest --validation --azure-validator --use=@microsoft.azure/classic-openapi-validator@latest --use=@microsoft.azure/openapi-validator@latest [--tag=] - ``` + +### Document Please see [readme](https://github.com/Azure/azure-openapi-validator/blob/master/README.md) for how to install or run tool in details. Or you can run it in [OpenAPI Hub](https://portal.azure-devex-tools.com/tools/linter). Refer to [openapi-authoring-automated-guidelines](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md) for detailed description of all lint rules and how-to-fix guidance. @@ -91,6 +98,30 @@ Note: When running in Swagger PR pipeline, Avocado only report errors with file Refer to [Avocado Readme](https://github.com/Azure/avocado/blob/master/README.md) for detailed description of validations and how-to-fix guidance. + +## SDK Track2 Validation + +This CI check is to run [autorest.modelerfour](https://github.com/Azure/autorest.modelerfour) for each changing tag in a PR. +Since the code generators of track2 SDK are based on the autorest.modelerfour, it's recommended ensure this validation is passed without any error and warning. +The `modelerfour` has several plugins. If a plugin report an error, you can refer to the following plugin documentations: +- [PreChecker](https://github.com/Azure/autorest/blob/master/docs/openapi/prechecker.md) + +### Run locally: + +#### Prerequisites: + +``` +npm install -g autorest +``` +#### Given a swagger spec, run the validator: +``` +autorest --v3 --azure-validator --use=@microsoft.azure/openapi-validator@latest --input-file= +``` +#### Given a readme file, run the validator: +``` +autorest --v3 --azure-validator --semantic-validator=false --model-validator=false --use=@microsoft.azure/openapi-validator@latest [--tag=] +``` + ## Suppression Process In case there are validation errors reported against your service that you believe do not apply, we have a suppression process you can follow to permanently remove these reported errors for your specs. Refer to [Swagger Suppression Process](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/85/Swagger-Suppression-Process) for detailed guidance.