Skip to content

[new rule]: Path parameter names in different API path should be consistent in one RP #314

@jianyexi

Description

@jianyexi

Lint rule description

Path parameter names in different API path should be consistent in one RP. If there is a API definition "/A/{name}", then its child API definitions should use the same path parameter name "{name}", like "/A/{name}/B", NOT "/A/{Aname}/B"

Related swagger example

  1. Compute The below 2 API below are share the same context, but unfortunately they are using different virtual machine scale set name (e.g. {virtualMachineScaleSetName} v.s. {vmScaleSetName}. - https://github.com/Azure/azure-rest-api-specs/blob/2c6bb907c749885e933bdb4e1a40f71bd9a60c3a/specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/compute.json#L7587 - https://github.com/Azure/azure-rest-api-specs/blob/2c6bb907c749885e933bdb4e1a40f71bd9a60c3a/specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/compute.json#L7651 2. Web The below 2 API use different web site names (e.g. {siteName} v.s. {name}). They are defined 2 files, but belong to the same RP. - https://github.com/Azure/azure-rest-api-specs/blob/2c6bb907c749885e933bdb4e1a40f71bd9a60c3a/specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/Diagnostics.json#L327 - https://github.com/Azure/azure-rest-api-specs/blob/2c6bb907c749885e933bdb4e1a40f71bd9a60c3a/specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/WebApps.json#L97

Azure/azure-rest-api-specs#18660

Category

SDK

Severity level

Error

Applies to

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

How to fix the violation

consider using the same parameter name in different API path

What't the impact if breaking the rule

will bring confusion and inconsistency

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions