Azure / azure-openapi-validator

Azure Open API Validator
MIT License
47 stars 46 forks source link

Update the version format check for canonical swagger #707

Open dinwa-ms opened 3 months ago

dinwa-ms commented 3 months ago

Lint rule description

For canonical swagger, the version info is "canonical", which violates the existing rule of the formate "Year-Month-Date". Can we make this a special case for canonical swagger?

image

There are some discussion about it in the channel

image

Related swagger example

{ "swagger": "2.0", "info": { "title": "Microsoft.Contoso management service", "version": "canonical", "description": "Microsoft.Contoso Resource Provider management API.", "x-canonical-included-versions": [ "v2021_10_01_preview" ], "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest-canonical" } ] }, "schemes": [ "https" ], ...

Category

SDK

Severity level

Error

Applies to

Management plane API spec, Data plane API spec, RPaaS API spec

How to fix the violation

For canonical swagger, set the version to "canonical"; for versioned swagger, set the version to the specific version.

What't the impact if breaking the rule

The information will be misleading.

dinwa-ms commented 2 months ago

Could you help provide an update on this issue? Thanks

mikeharder commented 2 months ago

@rkmanda @bdefoy @tejaswiMinnu @AkhilaIlla: I believe this is an ARM-only rule:

https://github.com/Azure/azure-openapi-validator/blob/f3fcf47c9f74b15e90e5198bf09bb6569e13213e/packages/rulesets/src/spectral/az-arm.ts#L1066

dinwa-ms commented 1 month ago

Hi @rkmanda @bdefoy @tejaswiMinnu @AkhilaIlla, may I ask is anyone working on this issue and is there any update or ETA on it? Thanks.

dinwa-ms commented 1 month ago

If it hasn't started, I can try to work on it and will share the code change for review.

dinwa-ms commented 1 month ago

Created PR for this issue Update arm APIVersionPattern rule for canonical swagger #732