In the following PR, rule GetCollectionResponseSchema raised an error that appears to be a false positive, caused by two paths that share the same "/providers..." suffix.
My first question is whether this scenario, where two paths in a spec only vary by a /subscriptions/{subscriptionId} prefix, but return different data types, should even be allowed?
@bdefoy, @rkmanda: What do you think?
If not, then the rule is technically correct to raise an error here, but the error message is misleading.
If so, then the rule will need to be updated to allow it. Inspecting the code, I believe the root cause is around here, since it only considers the path after the last index of "/providers". This code would need to be updated, to consider the prefix before this as well.
Overview
In the following PR, rule
GetCollectionResponseSchema
raised an error that appears to be a false positive, caused by two paths that share the same "/providers..." suffix.https://github.com/Azure/azure-rest-api-specs/pull/30656#discussion_r1802351631
My first question is whether this scenario, where two paths in a spec only vary by a
/subscriptions/{subscriptionId}
prefix, but return different data types, should even be allowed?@bdefoy, @rkmanda: What do you think?
If not, then the rule is technically correct to raise an error here, but the error message is misleading.
If so, then the rule will need to be updated to allow it. Inspecting the code, I believe the root cause is around here, since it only considers the path after the last index of
"/providers"
. This code would need to be updated, to consider the prefix before this as well.https://github.com/Azure/azure-openapi-validator/blob/edb65591d5ab85871f880e48b2ad6302186014b8/packages/rulesets/src/native/utilities/arm-helper.ts#L508-L516
V1 APIs
/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version} operationId:
ExtensionMetadata_Get
Response:#/definitions/ExtensionValue
/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions operationId:
ExtensionMetadata_List
Response:#/definitions/ExtensionValueListResult
V2 APIs
/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version} operationId:
ExtensionMetadataV2_Get
Response:#/definitions/ExtensionValueV2
/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions operationId:
ExtensionMetadataV2_List
Response:#/definitions/ExtensionValueListResultV2