Skip to content

Latest commit

 

History

History
80 lines (63 loc) · 1.75 KB

patch-response-codes.md

File metadata and controls

80 lines (63 loc) · 1.75 KB

PatchResponseCodes

Category

ARM Error

Applies to

ARM OpenAPI(swagger) specs

Related ARM Guideline Code

  • RPC-Patch-V1-06

Output Message

Synchronous PATCH operations must have 200 and default return codes. They also must not have other response codes. LRO PATCH operations must have 200, 202, and default return codes. They also must not have other response codes.

Description

Synchronous PATCH must have 200 return code and LRO PATCH must have 200 and 202 return codes.

How to fix the violation

For a synchronous PATCH add 200 and default return codes and make sure they don't have other response codes. For LRO PATCH add 200, 202 and default return codes and make sure they don't have other response codes. 202 response for a LRO PATCH operation must not have a response schema specified.

Example

The following would be a valid SYNC PATCH:

...
patch {
  "responses": {
    "200": {
      "description": "Operation completed",
      "schema": {
        "$ref": "#/definitions/FooResource",
      },
    },
    "default": {
      "description": "Error response describing why the operation failed.",
      "schema": {
        "$ref": "#/definitions/ErrorResponse"
      }
    }
  }
}  
...

The following would be a valid ASYNC PATCH:

...
patch{
  "responses": {
      "202": {
        "description": "Operation accepted",
      },
      "200": {
        "description": "Operation completed",
        "schema": {
          "$ref": "#/definitions/FooResource",
        },
      },
      "default": {
        "description": "Error response describing why the operation failed.",
        "schema": {
          "$ref": "#/definitions/ErrorResponse"
        }
      }
    },
  "x-ms-long-running-operation": true,
}
...