Azure / azure-openapi-validator

Azure Open API Validator
MIT License
48 stars 45 forks source link

Warnings are reported when using parameters from the common types #286

Open mbashtovaya opened 2 years ago

mbashtovaya commented 2 years ago

Describe the bug

The following warnings are being reported by the autorest:

warning | ParameterNotDefinedInGlobalParameters/R2015/SDKViolation | Parameter "subscriptionid" is referenced but not defined in the global parameters section of Service Definition
warning | ParameterNotDefinedInGlobalParameters/R2015/SDKViolation | Parameter "api-version" is referenced but not defined in the global parameters section of Service Definition

These 2 parameters are defined in the swagger as:

  {
    "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
  },
  {
    "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter"
  }

These are the references to the defined in common-types global parameters, which produce the correct swagger. It seems that this is a false positive.

To Reproduce Steps to reproduce the behavior:

Expected behavior There should be no warning generated.

Desktop (please complete the following information):

Showing All Installed Extensions

Type Extension Name Version Location extension @autorest/az 1.8.0 /home/mbashtovaya/.autorest/@autorest_az@1.8.0 extension @autorest/clicommon 0.6.2 /home/mbashtovaya/.autorest/@autorest_clicommon@0.6.2 core @autorest/core 3.7.6 /home/mbashtovaya/.autorest/@autorest_core@3.7.6 core @autorest/core 3.8.1 /home/mbashtovaya/.autorest/@autorest_core@3.8.1 core @autorest/core 3.8.3 /home/mbashtovaya/.autorest/@autorest_core@3.8.3 extension @autorest/modelerfour 4.15.421 /home/mbashtovaya/.autorest/@autorest_modelerfour@4.15.421 extension @autorest/python 5.4.0 /home/mbashtovaya/.autorest/@autorest_python@5.4.0 extension @microsoft.azure/classic-openapi-validator 1.1.13 /home/mbashtovaya/.autorest/@microsoft.azure_classic-openapi-validator@1.1.13 extension @microsoft.azure/openapi-validator 1.7.0 /home/mbashtovaya/.autorest/@microsoft.azure_openapi-validator@1.7.0 extension oav 0.4.70 /home/mbashtovaya/.autorest/oav@0.4.70


 - AutoRest core version: any of the installed (3.7.6, 3.8.1, 3.8.3)

**Additional context**
Add any other context about the problem here.
jianyexi commented 2 years ago

@mb139h could you give the command line or PR link ?

mbashtovaya commented 2 years ago

@mb139h could you give the command line or PR link ?

@jianyexi I do not believe any of the PRs report it because as far as I can tell there is a logic to ignore the issues coming from the common-types. Here is one anyway in case you can get anything out of it: https://github.com/Azure/azure-rest-api-specs-pr/pull/7097

The above is executed on the WSL2. autorest ./specification/networkcloud/resource-manager/readme.md --azure-validator --semantic-validator=true --model-validator=true --openapi-type=arm --version=3.8.1