Azure / openapi-diff

Command line tool to detect breaking changes between two openapi specifications
MIT License
256 stars 36 forks source link

api-version should not cause a ChangedParameterOrder error #287

Open cataggar opened 9 months ago

cataggar commented 9 months ago

I'm working on https://github.com/Azure/azure-rest-api-specs-pr/pull/15631 . I have 57 ChangedParameterOrder breaking change errors. Many are due to ApiVersionParameter changing order. It should be ignored by the ChangedParameterOrder rule.

ChangedParameterOrder

This is the original.

        "operationId": "Locations_CheckQuotaAvailability",
        "parameters": [
          {
            "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
          },
          {
            "name": "location",
            "in": "path",
            "required": true,
            "type": "string",
            "description": "Azure region"
          },
          {
            "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter"
          }
        ],

To:

        "operationId": "Locations_CheckQuotaAvailability",
        "parameters": [
          {
            "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
          },
          {
            "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
          },
          {
            "name": "location",
            "in": "path",
            "description": "A location in a subscription",
            "required": true,
            "type": "string",
            "pattern": "^[-\\w\\._]+$"
          }
        ],

If I move the ApiVersionParameter in the original version to be first, the rule does not consider it breaking.

mikekistler commented 9 months ago

Also reported here: https://github.com/Azure/azure-sdk-tools/issues/7170