scim2-models 0.6.0__tar.gz → 0.6.2__tar.gz
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-0.6.0 → scim2_models-0.6.2}/PKG-INFO +1 -1
- {scim2_models-0.6.0 → scim2_models-0.6.2}/pyproject.toml +1 -1
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/exceptions.py +29 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/path.py +3 -1
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/resource.py +6 -6
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/user.py +1 -1
- {scim2_models-0.6.0 → scim2_models-0.6.2}/LICENSE +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/README.md +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/__init__.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/annotations.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/attributes.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/base.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/constants.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/context.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/__init__.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/bulk.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/error.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/list_response.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/message.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/patch_op.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/messages/search_request.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/py.typed +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/reference.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/__init__.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/enterprise_user.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/group.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/resource_type.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/schema.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/resources/service_provider_config.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/scim_object.py +0 -0
- {scim2_models-0.6.0 → scim2_models-0.6.2}/scim2_models/utils.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scim2-models"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.2"
|
|
8
8
|
description = "SCIM2 models serialization and validation with pydantic"
|
|
9
9
|
authors = [{name="Yaal Coop", email="contact@yaal.coop"}]
|
|
10
10
|
license = {file = "LICENSE"}
|
|
@@ -52,6 +52,21 @@ class SCIMException(Exception):
|
|
|
52
52
|
{"scim_type": self.scim_type, "status": self.status, **self.context},
|
|
53
53
|
)
|
|
54
54
|
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_error(cls, error: "Error") -> "SCIMException":
|
|
57
|
+
"""Create an exception from a SCIM Error object.
|
|
58
|
+
|
|
59
|
+
:param error: The SCIM Error object to convert.
|
|
60
|
+
:return: The appropriate SCIMException subclass instance.
|
|
61
|
+
"""
|
|
62
|
+
from .messages.error import Error
|
|
63
|
+
|
|
64
|
+
if not isinstance(error, Error):
|
|
65
|
+
raise TypeError(f"Expected Error, got {type(error).__name__}")
|
|
66
|
+
|
|
67
|
+
exception_class = _SCIM_TYPE_TO_EXCEPTION.get(error.scim_type or "", cls)
|
|
68
|
+
return exception_class(detail=error.detail)
|
|
69
|
+
|
|
55
70
|
|
|
56
71
|
class InvalidFilterException(SCIMException):
|
|
57
72
|
"""The specified filter syntax was invalid.
|
|
@@ -263,3 +278,17 @@ class SensitiveException(SCIMException):
|
|
|
263
278
|
"The specified request cannot be completed, due to the passing of sensitive "
|
|
264
279
|
"information in a request URI"
|
|
265
280
|
)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
_SCIM_TYPE_TO_EXCEPTION: dict[str, type[SCIMException]] = {
|
|
284
|
+
"invalidFilter": InvalidFilterException,
|
|
285
|
+
"tooMany": TooManyException,
|
|
286
|
+
"uniqueness": UniquenessException,
|
|
287
|
+
"mutability": MutabilityException,
|
|
288
|
+
"invalidSyntax": InvalidSyntaxException,
|
|
289
|
+
"invalidPath": InvalidPathException,
|
|
290
|
+
"noTarget": NoTargetException,
|
|
291
|
+
"invalidValue": InvalidValueException,
|
|
292
|
+
"invalidVers": InvalidVersionException,
|
|
293
|
+
"sensitive": SensitiveException,
|
|
294
|
+
}
|
|
@@ -129,7 +129,9 @@ class Path(UserString, Generic[ResourceT]):
|
|
|
129
129
|
serialization=core_schema.plain_serializer_function_ser_schema(str),
|
|
130
130
|
)
|
|
131
131
|
|
|
132
|
-
def __init__(self, path: str):
|
|
132
|
+
def __init__(self, path: "str | Path[Any]"):
|
|
133
|
+
if isinstance(path, Path):
|
|
134
|
+
path = str(path)
|
|
133
135
|
self.check_syntax(path)
|
|
134
136
|
self.data = path
|
|
135
137
|
|
|
@@ -386,8 +386,8 @@ class Resource(ScimObject, Generic[AnyExtension]):
|
|
|
386
386
|
def _prepare_model_dump(
|
|
387
387
|
self,
|
|
388
388
|
scim_ctx: Context | None = Context.DEFAULT,
|
|
389
|
-
attributes: list[str] | None = None,
|
|
390
|
-
excluded_attributes: list[str] | None = None,
|
|
389
|
+
attributes: list[str | Path[Any]] | None = None,
|
|
390
|
+
excluded_attributes: list[str | Path[Any]] | None = None,
|
|
391
391
|
**kwargs: Any,
|
|
392
392
|
) -> dict[str, Any]:
|
|
393
393
|
kwargs = super()._prepare_model_dump(scim_ctx, **kwargs)
|
|
@@ -410,8 +410,8 @@ class Resource(ScimObject, Generic[AnyExtension]):
|
|
|
410
410
|
self,
|
|
411
411
|
*args: Any,
|
|
412
412
|
scim_ctx: Context | None = Context.DEFAULT,
|
|
413
|
-
attributes: list[str] | None = None,
|
|
414
|
-
excluded_attributes: list[str] | None = None,
|
|
413
|
+
attributes: list[str | Path[Any]] | None = None,
|
|
414
|
+
excluded_attributes: list[str | Path[Any]] | None = None,
|
|
415
415
|
**kwargs: Any,
|
|
416
416
|
) -> dict[str, Any]:
|
|
417
417
|
"""Create a model representation that can be included in SCIM messages by using Pydantic :code:`BaseModel.model_dump`.
|
|
@@ -436,8 +436,8 @@ class Resource(ScimObject, Generic[AnyExtension]):
|
|
|
436
436
|
self,
|
|
437
437
|
*args: Any,
|
|
438
438
|
scim_ctx: Context | None = Context.DEFAULT,
|
|
439
|
-
attributes: list[str] | None = None,
|
|
440
|
-
excluded_attributes: list[str] | None = None,
|
|
439
|
+
attributes: list[str | Path[Any]] | None = None,
|
|
440
|
+
excluded_attributes: list[str | Path[Any]] | None = None,
|
|
441
441
|
**kwargs: Any,
|
|
442
442
|
) -> str:
|
|
443
443
|
"""Create a JSON model representation that can be included in SCIM messages by using Pydantic :code:`BaseModel.model_dump_json`.
|
|
@@ -180,7 +180,7 @@ class Address(ComplexAttribute):
|
|
|
180
180
|
|
|
181
181
|
primary: bool | None = None
|
|
182
182
|
"""A Boolean value indicating the 'primary' or preferred attribute value
|
|
183
|
-
for this attribute, e.g., the preferred
|
|
183
|
+
for this attribute, e.g., the preferred address."""
|
|
184
184
|
|
|
185
185
|
|
|
186
186
|
class Entitlement(ComplexAttribute):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|