-
Notifications
You must be signed in to change notification settings - Fork 84
Description
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:
curl -X PATCH 'http://dev:api_key@localhost:3000/scim/v2/Users/819216' -d '{"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"], "Operations": [{"op":"Add","path":"displayName","value":"Norris, Chuck"}]}' -H 'Content-Type: application/scim+json'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.