Closed always-akshat closed 8 months ago
Closing this since I figured out how this works.
For anyone else who stumbles upon this problem -- The way PATCH works is by using the ingress and egress together. The request is first sent to the egress controller to parse the filter and get the Resource. Then, it creates an instance of updated Resource and passes that to the ingress handler.
Hi @always-akshat, Thanks for following up with the answer to your own question!
To clarify further, the SCIMMY.Resources.User
instance remains the same for both the ingress and egress methods while handling the request. When the patch
method is called, the return value of the egress method is used to create an instance of the SCIMMY.Schemas.User
schema. This is then passed to the apply
method of the SCIMMY.Messages.PatchOp
class. The operations in the PatchOp are then applied atomically to the schema instance, which enforces mutability and validity requirements. If the PatchOp is completed (i.e. all operations are valid and successful), the apply
method then calls the ingress handler with the patched schema instance, which is intended to write back any changes to your data source. The return value of the ingress handler is then used to create a new instance of the SCIMMY.Schemas.User
schema class, which is then compared to the schema instance created initially with the value returned by the egress handler. If any property at any depth differs, one final instance of the SCIMMY.Schemas.User
schema class is created by the patch
method, with the directionality set to "out", and the basepath and attribute filters supplied. The process is identical for the patch
method of the SCIMMY.Resources.Group
class, but using the SCIMMY.Schemas.Group
schema class instead.
Also, I believe this issue may be better suited being located in the main SCIMMY repository, as the relevant handling code lives there, so have transferred it over there.
Thanks, Sam
First off, sorry for adding all these issues. I am trying to implement a enterprise SCIM gateway on top of this.
Another problem I am seeing is the express handlers (views) not passing the operations for the PatchOp
Here's an example PATCH request
Here's my code that handles the request and passes it to a controller.
app.ts
users.controller.ts
When sending the mentioned PATCH request, my controller doesn't get any details about the PATCH Op
log from the controller
Do I need to add another patch handler?