From caee66d7beccf4e9d6f6fc62e83444f8de8789f5 Mon Sep 17 00:00:00 2001 From: raychen Date: Mon, 15 Mar 2021 14:42:22 +0800 Subject: [PATCH] Add LRO rules to semantic/model violations document. --- .../Semantic-and-Model-Violations-Reference.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/documentation/Semantic-and-Model-Violations-Reference.md b/documentation/Semantic-and-Model-Violations-Reference.md index 8ca56eac6d2f..c742440dda1d 100644 --- a/documentation/Semantic-and-Model-Violations-Reference.md +++ b/documentation/Semantic-and-Model-Violations-Reference.md @@ -91,6 +91,8 @@ This document lists the set of automated rules that can be validated against swa | [ROUNDTRIP_INCONSISTENT_PROPERTY](#ROUNDTRIP_INCONSISTENT_PROPERTY) | | | [ROUNDTRIP_MISSING_PROPERTY](#ROUNDTRIP_MISSING_PROPERTY) | | | [ROUNDTRIP_ADDITIONAL_PROPERTY](#ROUNDTRIP_ADDITIONAL_PROPERTY) | | +| [LRO_RESPONSE_CODE](#LRO_RESPONSE_CODE) | | +| [LRO_RESPONSE_HEADER](#LRO_RESPONSE_HEADER) | | ### Validation Warnings @@ -827,3 +829,19 @@ This document lists the set of automated rules that can be validated against swa **How to fix the violation**: - Check if the property is read-only. If yes, update the swagger definition for this property to mark it as "readOnly": true. Alternatively, keep the property in the GET schema but remove it from the PUT schema. - Check if the property has a default value. If yes, update the Swagger definition for this property to mark it with "default": annotation. + +### LRO_RESPONSE_CODE + +**Output Message**: Patch/Post long running operation must return 201 or 202, Delete long running operation must return 202 or 204, Put long running operation must return 202 or 201 or 200, but {statusCode} returned. + +**Description**: Long running operation must return specific response code as per http method type when this operation is annotated with x-ms-long-running-operation:true. + +**How to fix the violation**: Correct the response code per the guidance or remove annotation of x-ms-long-running-operation. + +### LRO_RESPONSE_HEADER + +**Output Message**: Long running operation should return {header} in header but not provided. + +**Description**: Long running operation must return location header or azure-AsyncOperation header in response when this operation is annotated with x-ms-long-running-operation:true. + +**How to fix the violation**: Adding one of these headers to the response.