scim2-models 0.5.1__py3-none-any.whl → 0.5.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scim2_models/base.py CHANGED
@@ -29,12 +29,21 @@ from scim2_models.utils import _normalize_attribute_name
29
29
  from scim2_models.utils import _to_camel
30
30
 
31
31
 
32
- def _contains_attribute_or_subattributes(
33
- attribute_urns: list[str], attribute_urn: str
34
- ) -> bool:
35
- return attribute_urn in attribute_urns or any(
36
- item.startswith(f"{attribute_urn}.") or item.startswith(f"{attribute_urn}:")
37
- for item in attribute_urns
32
+ def _is_attribute_requested(requested_urns: list[str], current_urn: str) -> bool:
33
+ """Check if an attribute should be included based on the requested URNs.
34
+
35
+ Returns True if:
36
+ - The current attribute is explicitly requested
37
+ - A sub-attribute of the current attribute is requested
38
+ - The current attribute is a sub-attribute of a requested attribute
39
+ """
40
+ return (
41
+ current_urn in requested_urns
42
+ or any(
43
+ item.startswith(f"{current_urn}.") or item.startswith(f"{current_urn}:")
44
+ for item in requested_urns
45
+ )
46
+ or any(current_urn.startswith(f"{item}.") for item in requested_urns)
38
47
  )
39
48
 
40
49
 
@@ -478,9 +487,7 @@ class BaseModel(PydanticBaseModel):
478
487
  if returnability == Returned.default and (
479
488
  (
480
489
  included_urns
481
- and not _contains_attribute_or_subattributes(
482
- included_urns, attribute_urn
483
- )
490
+ and not _is_attribute_requested(included_urns, attribute_urn)
484
491
  )
485
492
  or attribute_urn in excluded_urns
486
493
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scim2-models
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: SCIM2 models serialization and validation with pydantic
5
5
  Keywords: scim,scim2,provisioning,pydantic,rfc7643,rfc7644
6
6
  Author: Yaal Coop
@@ -1,7 +1,7 @@
1
1
  scim2_models/__init__.py,sha256=IACL_c94UhKq0ZEXOb3LMZgeEQMfQhdOVpWGDnHSpXo,3201
2
2
  scim2_models/annotations.py,sha256=oRjlKL1fqrYfa9UtaMdxF5fOT8CUUN3m-rdzvf7aiSA,3304
3
3
  scim2_models/attributes.py,sha256=bgYWgNUAuLuzLL7JzVU71-Y8404rQc2NiTgq2OtdMNM,1713
4
- scim2_models/base.py,sha256=RqRo5ju18Dbt-MB84KOtr3E_CZj9er-B7qDn12zKyyA,20400
4
+ scim2_models/base.py,sha256=0rTuItV2CPw1YNyhOfiwrNMrWRyg_FEHUdsJqvvT6eU,20727
5
5
  scim2_models/constants.py,sha256=9egq8JW0dFAqPng85CiHoH5T6pRtYL87-gC0C-IMGsk,573
6
6
  scim2_models/context.py,sha256=RjgMIvWPr8f41qbVL1sjaDnm9GRKyrCrgfC4npwwcMg,9149
7
7
  scim2_models/messages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,6 +24,6 @@ scim2_models/resources/user.py,sha256=9VkMmKNTLC5D4tIUtg-Avlr_AD5mZMli4vdnO9FNMy
24
24
  scim2_models/scim_object.py,sha256=4L10EKkrdaOCRf-J2P1P7yQaXYTztBhxH9rPQB-Bnnk,2367
25
25
  scim2_models/urn.py,sha256=E2YY8Lx_yuhLXtdqU9rNOXcb_-9rnndAXd35ie_mQSA,4061
26
26
  scim2_models/utils.py,sha256=YX_aQCLZY--s5isPEQT_iJygka1IKvP-F6Hly5fqjBI,5888
27
- scim2_models-0.5.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
28
- scim2_models-0.5.1.dist-info/METADATA,sha256=Y8-2HrRdIixXK9IqBK-6WhR8dPvG22O7HhMPDswVvYE,16485
29
- scim2_models-0.5.1.dist-info/RECORD,,
27
+ scim2_models-0.5.2.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
28
+ scim2_models-0.5.2.dist-info/METADATA,sha256=yESisSCt8u_HQj01ib0E2adgqMebJy2LwnS8jzTbpnU,16485
29
+ scim2_models-0.5.2.dist-info/RECORD,,