scim2-models 0.3.3__py3-none-any.whl → 0.3.5__py3-none-any.whl

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.
@@ -1,10 +1,12 @@
1
1
  from typing import Annotated
2
+ from typing import ClassVar
2
3
  from typing import Literal
3
4
  from typing import Optional
4
5
  from typing import Union
5
6
 
6
7
  from pydantic import Field
7
8
 
9
+ from ..base import ComplexAttribute
8
10
  from ..base import MultiValuedComplexAttribute
9
11
  from ..base import Mutability
10
12
  from ..base import Reference
@@ -41,3 +43,5 @@ class Group(Resource):
41
43
 
42
44
  members: Optional[list[GroupMember]] = None
43
45
  """A list of members of the Group."""
46
+
47
+ Members: ClassVar[type[ComplexAttribute]] = GroupMember
@@ -17,6 +17,7 @@ from ..base import BaseModelType
17
17
  from ..base import CaseExact
18
18
  from ..base import ComplexAttribute
19
19
  from ..base import ExternalReference
20
+ from ..base import MultiValuedComplexAttribute
20
21
  from ..base import Mutability
21
22
  from ..base import Required
22
23
  from ..base import Returned
@@ -253,8 +254,8 @@ class Resource(BaseModel, Generic[AnyExtension], metaclass=ResourceMetaclass):
253
254
  AnyResource = TypeVar("AnyResource", bound="Resource")
254
255
 
255
256
 
256
- def dedicated_attributes(model):
257
- """Return attributes that are not members of parent classes."""
257
+ def dedicated_attributes(model, excluded_models):
258
+ """Return attributes that are not members the parent 'excluded_models'."""
258
259
 
259
260
  def compare_field_infos(fi1, fi2):
260
261
  return (
@@ -268,8 +269,8 @@ def dedicated_attributes(model):
268
269
 
269
270
  parent_field_infos = {
270
271
  field_name: field_info
271
- for parent in model.__bases__
272
- for field_name, field_info in parent.model_fields.items()
272
+ for excluded_model in excluded_models
273
+ for field_name, field_info in excluded_model.model_fields.items()
273
274
  }
274
275
  field_infos = {
275
276
  field_name: field_info
@@ -283,7 +284,7 @@ def model_to_schema(model: type[BaseModel]):
283
284
  from scim2_models.rfc7643.schema import Schema
284
285
 
285
286
  schema_urn = model.model_fields["schemas"].default[0]
286
- field_infos = dedicated_attributes(model)
287
+ field_infos = dedicated_attributes(model, [Resource])
287
288
  attributes = [
288
289
  model_attribute_to_attribute(model, attribute_name)
289
290
  for attribute_name in field_infos
@@ -323,7 +324,9 @@ def model_attribute_to_attribute(model, attribute_name):
323
324
  sub_attributes = (
324
325
  [
325
326
  model_attribute_to_attribute(root_type, sub_attribute_name)
326
- for sub_attribute_name in dedicated_attributes(root_type)
327
+ for sub_attribute_name in dedicated_attributes(
328
+ root_type, [MultiValuedComplexAttribute]
329
+ )
327
330
  if (
328
331
  attribute_name != "sub_attributes"
329
332
  or sub_attribute_name != "sub_attributes"
@@ -1,5 +1,6 @@
1
1
  from enum import Enum
2
2
  from typing import Annotated
3
+ from typing import ClassVar
3
4
  from typing import Literal
4
5
  from typing import Optional
5
6
  from typing import Union
@@ -226,6 +227,8 @@ class User(Resource[AnyExtension]):
226
227
  name: Optional[Name] = None
227
228
  """The components of the user's real name."""
228
229
 
230
+ Name: ClassVar[type[ComplexAttribute]] = Name
231
+
229
232
  display_name: Optional[str] = None
230
233
  """The name of the User, suitable for display to end-users."""
231
234
 
@@ -271,29 +274,47 @@ class User(Resource[AnyExtension]):
271
274
  emails: Optional[list[Email]] = None
272
275
  """Email addresses for the user."""
273
276
 
277
+ Emails: ClassVar[type[ComplexAttribute]] = Email
278
+
274
279
  phone_numbers: Optional[list[PhoneNumber]] = None
275
280
  """Phone numbers for the User."""
276
281
 
282
+ PhoneNumbers: ClassVar[type[ComplexAttribute]] = PhoneNumber
283
+
277
284
  ims: Optional[list[Im]] = None
278
285
  """Instant messaging addresses for the User."""
279
286
 
287
+ Ims: ClassVar[type[ComplexAttribute]] = Im
288
+
280
289
  photos: Optional[list[Photo]] = None
281
290
  """URLs of photos of the User."""
282
291
 
292
+ Photos: ClassVar[type[ComplexAttribute]] = Photo
293
+
283
294
  addresses: Optional[list[Address]] = None
284
295
  """A physical mailing address for this User."""
285
296
 
297
+ Addresses: ClassVar[type[ComplexAttribute]] = Address
298
+
286
299
  groups: Annotated[Optional[list[GroupMembership]], Mutability.read_only] = None
287
300
  """A list of groups to which the user belongs, either through direct
288
301
  membership, through nested groups, or dynamically calculated."""
289
302
 
303
+ Groups: ClassVar[type[ComplexAttribute]] = GroupMembership
304
+
290
305
  entitlements: Optional[list[Entitlement]] = None
291
306
  """A list of entitlements for the User that represent a thing the User
292
307
  has."""
293
308
 
309
+ Entitlements: ClassVar[type[ComplexAttribute]] = Entitlement
310
+
294
311
  roles: Optional[list[Role]] = None
295
312
  """A list of roles for the User that collectively represent who the User
296
313
  is, e.g., 'Student', 'Faculty'."""
297
314
 
315
+ Roles: ClassVar[type[ComplexAttribute]] = Role
316
+
298
317
  x509_certificates: Optional[list[X509Certificate]] = None
299
318
  """A list of certificates issued to the User."""
319
+
320
+ X509Certificates: ClassVar[type[ComplexAttribute]] = X509Certificate
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scim2-models
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: SCIM2 models serialization and validation with pydantic
5
5
  Project-URL: documentation, https://scim2-models.readthedocs.io
6
6
  Project-URL: repository, https://github.com/python-scim/scim2-models
@@ -5,12 +5,12 @@ scim2_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  scim2_models/utils.py,sha256=MzZz212-lkVWgXcpXvNwoi_u28wBTpkTwPrfYC5v92A,2771
6
6
  scim2_models/rfc7643/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  scim2_models/rfc7643/enterprise_user.py,sha256=EaxdHH2dcBrwWwGpaZC6iZ9dbcaVN1NpoRLAdkTYssQ,1781
8
- scim2_models/rfc7643/group.py,sha256=CBmSnlzd4JktCpOmg4XkfJJUd8oD6KbYFRTt0dSdixE,1302
9
- scim2_models/rfc7643/resource.py,sha256=zMyk02Traoq6XNBcS_fSnXIOadZwxTdA9CV4vLuy38k,12648
8
+ scim2_models/rfc7643/group.py,sha256=JML8OtgKjvHHv2YufiYcTtbZuN5GFVQTbm1J6MLtp8o,1427
9
+ scim2_models/rfc7643/resource.py,sha256=PUWoajKewJuitaxVcClxfCucaSdkzIfphld-kK8KLdo,12812
10
10
  scim2_models/rfc7643/resource_type.py,sha256=p8IKV5IakPMBX6d2Fv2MFqaQL5iTw152vmozVVSC8gU,3196
11
11
  scim2_models/rfc7643/schema.py,sha256=B7TzMbT6ngYQrMqvqW5_LberN6EaqtZaFwBVsgoA3S0,10388
12
12
  scim2_models/rfc7643/service_provider_config.py,sha256=deMNCXlqiNzuLcVRN9mdHiTUxhczDnvi-oO6k-Anj8U,5402
13
- scim2_models/rfc7643/user.py,sha256=70b2x1yw1fOfQTNXZrQ7-t8tjnbEMARd8TIhxGuRMKQ,9991
13
+ scim2_models/rfc7643/user.py,sha256=EEje4V_zbMVwVYOu2Gj1W7GjD90WnC0lUK3FJuh4jWE,10607
14
14
  scim2_models/rfc7644/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  scim2_models/rfc7644/bulk.py,sha256=I6S40kyJPwDQwPFi668wFFDVTST7z6QTe9HTL5QUViI,2577
16
16
  scim2_models/rfc7644/error.py,sha256=l4-vtGQYm5u13-ParhbHSeqXEil0E09QXSO9twAT3SU,6185
@@ -18,7 +18,7 @@ scim2_models/rfc7644/list_response.py,sha256=ltjV1WII2fNy8j3RX8J0_Jb5DW4hTFoO6P-
18
18
  scim2_models/rfc7644/message.py,sha256=F4kPqbHAka3-wZzap9a45noQZw-o1vznTJypNABBF7w,253
19
19
  scim2_models/rfc7644/patch_op.py,sha256=OE-ixDanTkY5zQP7EK7OAp88uE_fMk03mqmaZHxgJ-g,2210
20
20
  scim2_models/rfc7644/search_request.py,sha256=DRGlixcWtYtbUuP9MT7PsnvyxlONLcXGEcQveWdqQng,3003
21
- scim2_models-0.3.3.dist-info/METADATA,sha256=hmfXljlZZNG73OFiK9DkGfebilRcTAVbBtPKWSP2v4M,16288
22
- scim2_models-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- scim2_models-0.3.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- scim2_models-0.3.3.dist-info/RECORD,,
21
+ scim2_models-0.3.5.dist-info/METADATA,sha256=h7WtwUPjMOgw4iUIhqrfdmISInw8dDyOupVqu308vYg,16288
22
+ scim2_models-0.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ scim2_models-0.3.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ scim2_models-0.3.5.dist-info/RECORD,,