Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
114 stars 181 forks source link

LintDiff: False positives for XmsClientNameParameter #7887

Open cataggar opened 8 months ago

cataggar commented 8 months ago

Very similar to #7886 for XmsClientName, but this is for XmsClientNameParameter. It is the same paths, except it is for x-ms-client-name.

The errors look like:

{"pluginName":"spectral","extensionName":"@microsoft.azure/openapi-validator","level":"warning","message":"Value of `x-ms-client-name` cannot be the same as Property/Model.","code":"XmsClientNameParameter"
      - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"].put.parameters[5] # addon

Looks like it is complaining that addon is both the name and x-ms-client-name.

          {
            "name": "addon",
            "in": "body",
            "description": "Resource create parameters.",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Addon"
            },
            "x-ms-client-name": "addon"
          }

The TypeSpec currently has this for compatibility with previous API version:

@@projectedName(Addons.createOrUpdate::parameters.resource, "json", "addon");
@@OpenAPI.extension(Addons.createOrUpdate::parameters.resource,
  "x-ms-client-name",
  "addon"
);

I'll see if I can remove the x-ms-client-name.

cataggar commented 8 months ago

If I remove

@@OpenAPI.extension(Addons.createOrUpdate::parameters.resource,
  "x-ms-client-name",
  "addon"
);

It defaults to resource. The previous API version used addon, so it is a breaking change.

image