Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support for bulk operations - #149

Open
frohrlich wants to merge 9 commits into
python-scim:mainfrom
frohrlich:bulk-operations
Open

Support for bulk operations#149
frohrlich wants to merge 9 commits into
python-scim:mainfrom
frohrlich:bulk-operations

Conversation

@frohrlich

@frohrlich frohrlich commented Aug 24, 2026

Copy link
Copy Markdown

Comment thread scim2_models/messages/bulk.py Outdated
Comment thread scim2_models/messages/bulk.py
Comment thread scim2_models/messages/bulk.py Outdated
@azmeuk

azmeuk commented Aug 27, 2026

Copy link
Copy Markdown
Member

Please unlist the bulk samples in tests/test_models.py test_parse_and_serialize_examples test.

Comment thread scim2_models/messages/bulk.py Outdated
if (
self.status is not None
and self.status >= 400
and not (self.response and self.response.get("detail"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is more convincing👌. Maybe you can also add this citation in comment?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
)

@azmeuk azmeuk Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scim2_models/messages/bulk.py Outdated
Comment thread tests/test_bulk.py Outdated
@frohrlich
frohrlich force-pushed the bulk-operations branch 2 times, most recently from 8e54571 to 53a5a80 Compare September 9, 2026 08:55
Comment thread scim2_models/messages/bulk.py
Comment thread doc/tutorial.rst Outdated
Comment thread doc/tutorial.rst Outdated
Comment thread scim2_models/messages/bulk.py Outdated
"""The resource's relative path to the SCIM service provider's root."""

data: Any | None = None
data: Annotated[Any | None, Returned.request] = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think that BulkOperation BulkRequest and BulkResponse should be generic like it is done in patch for instance:

class PatchOperation(ComplexAttribute, Generic[ResourceT]):

This would allow to give a better type to data than Any, Probably something like ResourceT | PatchOp[ResourceT] | None

Comment thread scim2_models/messages/bulk.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here, making the classes generic would allow for ResourceT | Error | None instead of Any

…sses, which allows for correct attribute typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants