Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
113 stars 177 forks source link

[LintDiff][False positive][~[Staging] Swagger LintDiff failed] Incorrect validation rule "DeleteResponseCodes" #6199

Open vatsalyachauhan opened 1 year ago

vatsalyachauhan commented 1 year ago

Describe the bug The rule DeleteResponseCodes might be incorrect. I believe, an async api implementation may choose to complete the operation Synchronously based on some conditions and return 200 instead of 202.

Reference: DeleteOperationAsyncResponseValidation

Example where the validation failed: https://github.com/Azure/azure-rest-api-specs/pull/24037/checks?check_run_id=13566776598

konrad-jamrozik commented 1 year ago

@bdefoy @rkmanda FYI

rkmanda commented 1 year ago

Task 23293646: [LintDiff][False positive] [~[Staging] Swagger LintDiff failed] Incorrect validation rule "DeleteResponseCodes"

rkmanda commented 1 year ago

Any operation must either be defined as sync or async as per the data plane guidelines. ARM adopts the same rule but allows for a 204 to be returned when the resource is already deleted. So the valid status codes are 200 and 204 for sync delete and 202 and 204 for async delete. What are the conditions under which a 200 maybe returned for an async delete in your scenario?

rkmanda commented 1 year ago

Data plane guidance that we are aligning to is documented here - https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#lro-returns-only-202