Skip to content

Commit c4b3956

Browse files
committed
refactor: rename ComplexAttribute.attribute_urn in _attribute_urn
1 parent b234632 commit c4b3956

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

scim2_models/attributes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class ComplexAttribute(BaseModel):
1717
"""A complex attribute as defined in :rfc:`RFC7643 §2.3.8 <7643#section-2.3.8>`."""
1818

19-
attribute_urn: Optional[str] = Field(None, exclude=True)
19+
_attribute_urn: Optional[str] = None
2020

2121
def get_attribute_urn(self, field_name: str) -> str:
2222
"""Build the full URN of the attribute.
@@ -26,7 +26,7 @@ def get_attribute_urn(self, field_name: str) -> str:
2626
alias = (
2727
self.__class__.model_fields[field_name].serialization_alias or field_name
2828
)
29-
return f"{self.attribute_urn}.{alias}"
29+
return f"{self._attribute_urn}.{alias}"
3030

3131

3232
class MultiValuedComplexAttribute(ComplexAttribute):

scim2_models/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,15 @@ def check_mutability_issues(
290290
cls.check_mutability_issues(original_val, replacement_value)
291291

292292
def set_complex_attribute_urns(self) -> None:
293-
"""Navigate through attributes and sub-attributes of type ComplexAttribute, and mark them with a 'attribute_urn' attribute.
293+
"""Navigate through attributes and sub-attributes of type ComplexAttribute, and mark them with a '_attribute_urn' attribute.
294294
295-
'attribute_urn' will later be used by 'get_attribute_urn'.
295+
'_attribute_urn' will later be used by 'get_attribute_urn'.
296296
"""
297297
from .attributes import ComplexAttribute
298298
from .attributes import is_complex_attribute
299299

300300
if isinstance(self, ComplexAttribute):
301-
main_schema = self.attribute_urn
301+
main_schema = self._attribute_urn
302302
separator = "."
303303
else:
304304
main_schema = self.__class__.model_fields["schemas"].default[0]
@@ -314,9 +314,9 @@ def set_complex_attribute_urns(self) -> None:
314314
if attr_value := getattr(self, field_name):
315315
if isinstance(attr_value, list):
316316
for item in attr_value:
317-
item.attribute_urn = schema
317+
item._attribute_urn = schema
318318
else:
319-
attr_value.attribute_urn = schema
319+
attr_value._attribute_urn = schema
320320

321321
@field_serializer("*", mode="wrap")
322322
def scim_serializer(

0 commit comments

Comments
 (0)