When the PATCH endpoint (which is not complete or scim complaint yet) receives a request with a payload that is not supported yet, it intends to return a 422 and message like: "Invalid PATCH request. This PATCH endpoint only supports deprovisioning and reprovisioning records.","status":"422"
However, when receiving the following invalid body:
To solve this, let's add more specific validation for the types of patch requests we do except currently so that we can return that 422 instead of raising a 500 error when someone supplies an invalid patch body.
When the PATCH endpoint (which is not complete or scim complaint yet) receives a request with a payload that is not supported yet, it intends to return a 422 and message like:
"Invalid PATCH request. This PATCH endpoint only supports deprovisioning and reprovisioning records.","status":"422"
However, when receiving the following invalid body:
{"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"], "Operations": [{"op":"Add","path":"displayName","value":"Norris, Chuck"}]}
the gem raises a 500 error because it's expecting "value" to contain an object not a string.
Here is a full curl request to reproduce:
To solve this, let's add more specific validation for the types of patch requests we do except currently so that we can return that 422 instead of raising a 500 error when someone supplies an invalid patch body.