Skip to content

Commit 8112273

Browse files
committed
refactor: move _prepare_model_dump to ScimObject
1 parent a4c258f commit 8112273

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

scim2_models/base.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -426,19 +426,6 @@ def model_validate(
426426

427427
return super().model_validate(*args, **kwargs)
428428

429-
def _prepare_model_dump(
430-
self,
431-
scim_ctx: Optional[Context] = Context.DEFAULT,
432-
**kwargs: Any,
433-
) -> dict[str, Any]:
434-
kwargs.setdefault("context", {}).setdefault("scim", scim_ctx)
435-
436-
if scim_ctx:
437-
kwargs.setdefault("exclude_none", True)
438-
kwargs.setdefault("by_alias", True)
439-
440-
return kwargs
441-
442429
def get_attribute_urn(self, field_name: str) -> str:
443430
"""Build the full URN of the attribute.
444431

scim2_models/scim_object.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ class ScimObject(BaseModel):
9797
SCIM schemas that define the attributes present in the current JSON
9898
structure."""
9999

100+
def _prepare_model_dump(
101+
self,
102+
scim_ctx: Optional[Context] = Context.DEFAULT,
103+
**kwargs: Any,
104+
) -> dict[str, Any]:
105+
kwargs.setdefault("context", {}).setdefault("scim", scim_ctx)
106+
107+
if scim_ctx:
108+
kwargs.setdefault("exclude_none", True)
109+
kwargs.setdefault("by_alias", True)
110+
111+
return kwargs
112+
100113
def model_dump(
101114
self,
102115
*args: Any,

0 commit comments

Comments
 (0)