python-scim / scim2-models

SCIM resources serialization and validation with Pydantic
https://scim2-models.readthedocs.io
Apache License 2.0
11 stars 3 forks source link

Attributes of schema extensions can not be dumped #49

Closed ccoors closed 4 months ago

ccoors commented 4 months ago

See test case. It was not possible to dump attributes of schema extensions. scim_response_serializer used self.get_attribute_urn to get the URN of EnterpriseUser (which results in attribute_urn to be urn:ietf:params:scim:schemas:core:2.0:user:urn:ietf:params:scim:schemas:extension:enterprise:2.0:user, probably also a bug), which does not get dumped.

This changes the code so that schema extensions are always returned. If no attributes from the extensions are requested, it still always returns a dict with schemas (which is expected).

azmeuk commented 4 months ago

This is fixed with the help of a serializer that hides attributes coming from Resource:

https://github.com/yaal-coop/scim2-models/blob/34bf363232a75f0bc00d535c33c9dc9686531517/scim2_models/rfc7643/resource.py#L94-L107

Thank you!