File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 11from inspect import isclass
2- from typing import TYPE_CHECKING
32from typing import Any
43from typing import Optional
54from typing import get_args
2928
3029from .utils import UNION_TYPES
3130
32- if TYPE_CHECKING :
33- pass
34-
3531
3632def contains_attribute_or_subattributes (
3733 attribute_urns : list [str ], attribute_urn : str
@@ -448,13 +444,17 @@ def get_attribute_urn(self, field_name: str) -> str:
448444
449445 See :rfc:`RFC7644 §3.10 <7644#section-3.10>`.
450446 """
447+ from scim2_models .rfc7643 .resource import Extension
448+
451449 main_schema = self .__class__ .model_fields ["schemas" ].default [0 ]
452- alias = (
453- self .__class__ .model_fields [field_name ].serialization_alias or field_name
450+ field = self .__class__ .model_fields [field_name ]
451+ alias = field .serialization_alias or field_name
452+ field_type = self .get_field_root_type (field_name )
453+ full_urn = (
454+ alias
455+ if isclass (field_type ) and issubclass (field_type , Extension )
456+ else f"{ main_schema } :{ alias } "
454457 )
455-
456- # if alias contains a ':' this is an extension urn
457- full_urn = alias if ":" in alias else f"{ main_schema } :{ alias } "
458458 return full_urn
459459
460460
You can’t perform that action at this time.
0 commit comments