Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ListResponse attributes inclusion and exclusion #59

Open
azmeuk opened this issue Jul 25, 2024 · 0 comments
Open

Implement ListResponse attributes inclusion and exclusion #59

azmeuk opened this issue Jul 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@azmeuk
Copy link
Contributor

azmeuk commented Jul 25, 2024

It would be nice if ListResponse (and other subclasses of Message?) 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",
            }
        ],
    }
@azmeuk azmeuk added the enhancement New feature or request label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant