scim2-models 0.6.1__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.
Files changed (31) hide show
  1. {scim2_models-0.6.1 → scim2_models-0.6.2}/PKG-INFO +1 -1
  2. {scim2_models-0.6.1 → scim2_models-0.6.2}/pyproject.toml +1 -1
  3. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/exceptions.py +29 -0
  4. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/user.py +1 -1
  5. {scim2_models-0.6.1 → scim2_models-0.6.2}/LICENSE +0 -0
  6. {scim2_models-0.6.1 → scim2_models-0.6.2}/README.md +0 -0
  7. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/__init__.py +0 -0
  8. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/annotations.py +0 -0
  9. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/attributes.py +0 -0
  10. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/base.py +0 -0
  11. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/constants.py +0 -0
  12. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/context.py +0 -0
  13. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/__init__.py +0 -0
  14. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/bulk.py +0 -0
  15. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/error.py +0 -0
  16. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/list_response.py +0 -0
  17. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/message.py +0 -0
  18. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/patch_op.py +0 -0
  19. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/messages/search_request.py +0 -0
  20. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/path.py +0 -0
  21. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/py.typed +0 -0
  22. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/reference.py +0 -0
  23. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/__init__.py +0 -0
  24. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/enterprise_user.py +0 -0
  25. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/group.py +0 -0
  26. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/resource.py +0 -0
  27. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/resource_type.py +0 -0
  28. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/schema.py +0 -0
  29. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/resources/service_provider_config.py +0 -0
  30. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/scim_object.py +0 -0
  31. {scim2_models-0.6.1 → scim2_models-0.6.2}/scim2_models/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scim2-models
3
- Version: 0.6.1
3
+ Version: 0.6.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
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scim2-models"
7
- version = "0.6.1"
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
+ }
@@ -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 photo or thumbnail."""
183
+ for this attribute, e.g., the preferred address."""
184
184
 
185
185
 
186
186
  class Entitlement(ComplexAttribute):
File without changes
File without changes