Skip to content

Implement ListResponse attributes inclusion and exclusion #59

@azmeuk

Description

@azmeuk

attributes and excluded_attributes are currently handle by Resources, but it would be nice if ListResponse could correctly handle the attributes and excluded_attributes parameters, in the behalf of the resources they embed.

def test_attributes_inclusion():
    response = ListResponse.of(User)(
        resources=[
            User(id="user-id", user_name="user-name", display_name="display-name")
        ]
    )
    payload = response.model_dump(
        scim_ctx=Context.RESOURCE_QUERY_RESPONSE, attributes=["userName"]
    )
    assert payload == {
        "schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
        "Resources": [
            {
                "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
                "id": "user-id",
                "userName": "user-name",
            }
        ],
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions