Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scim2_models/messages/list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def check_results_number(
"Field 'total_results' is required but value is missing or null",
)

if obj.total_results > 0 and not obj.resources:
if obj.total_results > 0 and obj.resources is None:
raise PydanticCustomError(
"no_resource_error",
"Field 'resources' is missing or null but 'total_results' is non-zero.",
Expand Down
5 changes: 1 addition & 4 deletions tests/test_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,7 @@ def test_zero_results():
ListResponse[User].model_validate(payload, scim_ctx=Context.RESOURCE_QUERY_RESPONSE)

payload = {"totalResults": 1, "Resources": []}
with pytest.raises(ValidationError):
ListResponse[User].model_validate(
payload, scim_ctx=Context.RESOURCE_QUERY_RESPONSE
)
ListResponse[User].model_validate(payload, scim_ctx=Context.RESOURCE_QUERY_RESPONSE)

payload = {"totalResults": 1}
with pytest.raises(ValidationError):
Expand Down
Loading