Skip to content

Latest commit

 

History

History
86 lines (77 loc) · 2.36 KB

1050.md

File metadata and controls

86 lines (77 loc) · 2.36 KB

1050 - ParameterLocationHasChanged

Description: Checks whether any parameter's location (x-ms-parameter-location) is changed from the previous specification. This is AutoRest-specific rule. Per the example provided in specifying required parameters and properties, and per the documentation of x-ms-parameter-location:

  • non-global parameters have implicitly method location and this cannot be changed.
  • global parameters have implicitly client location and this can be changed to method via x-ms-parameter-location.

Cause: Changing parameter location from client to method or vice-versa is considered a breaking change.

Related rules

Example: Parameter foo is changed from being non-global parameter to global parameter in the new version, hence changing its location from method to client.

Old specification

{
  "swagger": "2.0",
  "info": {
    "title": "swagger",
    "description": "The Azure Management API.",
    "version": "2016-12-01",
    ...
    ...
  "paths": {
    "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/resource1/{a}": {
      "get": {
        ...
        ...
        "parameters": [
          {
            "name": "foo",
            "in": "path",
            "type": "string"
          }
        ]
        ...
        ...
      }
    }
    ...
    ...  

New specification

{
  "swagger": "2.0",
  "info": {
    "title": "swagger",
    "description": "The Azure Management API.",
    "version": "2016-12-01",
    ...
    ...
  "paths": {
    "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/resource1/{a}": {
      "get": {
        ...
        ...
        "parameters": [
          {
            "ref": "#/parameters/foo"
          }
        ]
        ...
        ...
      }
    }
    ...
    ...
  "parameters": {
    "foo": {
      "name": "foo",
      "in": "path",
      "type": "string"
    }
  }