Support for bulk operations - #149
Conversation
31ed8e3 to
965e405
Compare
df89ee0 to
f049d6e
Compare
|
Please unlist the bulk samples in |
| if ( | ||
| self.status is not None | ||
| and self.status >= 400 | ||
| and not (self.response and self.response.get("detail")) |
There was a problem hiding this comment.
I am not sure about this one, the formulation is ambiguous.
status The HTTP response status code for the requested operation.
When indicating an error, the "response" attribute MUST contain
the detail error response as per Section 3.12.
I think the detail error response refers to the content of response being an error, more than the error detail attribute that should be set, or it would have been error response detail attribute.
What do you think?
There was a problem hiding this comment.
The 3.7.3 - Error handling section also mentions this description attribute.
If an error occurred, the status MUST also include the description attribute containing a human-readable explanation of the error.
It is followed by an example with the "detail" attribute with the description of the error. So I guessed this is what they're talking about.
There was a problem hiding this comment.
Ok this is more convincing👌. Maybe you can also add this citation in comment?
There was a problem hiding this comment.
Also I think the .get will break if the response is an Error object instead of the dict representing it:
BulkOperation.model_validate(
{"method": "POST", "bulkId": "q", "status": 400,
"response": Error(status=400, detail="bad request")},
scim_ctx=Context.RESOURCE_CREATION_RESPONSE,
)There was a problem hiding this comment.
Ok this is more convincing👌. Maybe you can also add this citation in comment?
Actually, I changed my mind. Actually this sentence appears to be a relic of the SCIM 1 draft, where description was a real attribute of status.
If an error occurred the status MUST also
include the description attribute containing a human readable
explanation of the error."status": {
"code": "201"
}The following is an example of a status in a failed operation.
"status": {
"code": "400",
"description": "Request is unparseable, syntactically incorrect, or violates schema."
}
Neither description nor status are valid in SCIM2. There is even an errata to RFC7644 which removes the status line which makes no sense here. This makes me think this in an error.
TL;DR: please allow empty detail parameters in error responses, but check that the response is actually an error object.
8e54571 to
53a5a80
Compare
| """The resource's relative path to the SCIM service provider's root.""" | ||
|
|
||
| data: Any | None = None | ||
| data: Annotated[Any | None, Returned.request] = None |
There was a problem hiding this comment.
Actually, I think that BulkOperation BulkRequest and BulkResponse should be generic like it is done in patch for instance:
This would allow to give a better type to data than Any, Probably something like ResourceT | PatchOp[ResourceT] | None
There was a problem hiding this comment.
Same thing here, making the classes generic would allow for ResourceT | Error | None instead of Any
…ter in the payload
f958f2e to
ff115e8
Compare
…sses, which allows for correct attribute typing
ff115e8 to
41de870
Compare
…ntly being created via the 'bulkId:' prefix
See RFC7644#3.7. Bulk Operations
Resolves #13, #14, #15, #16, #18.