scim2-models 0.4.2__tar.gz → 0.5.0__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 (121) hide show
  1. scim2_models-0.5.0/PKG-INFO +280 -0
  2. {scim2_models-0.4.2 → scim2_models-0.5.0}/pyproject.toml +7 -3
  3. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/attributes.py +1 -1
  4. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/messages/patch_op.py +19 -4
  5. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/group.py +1 -2
  6. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/resource.py +1 -5
  7. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/schema.py +4 -11
  8. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/service_provider_config.py +2 -2
  9. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/user.py +43 -12
  10. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/urn.py +23 -7
  11. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/utils.py +4 -0
  12. scim2_models-0.4.2/.github/FUNDING.yml +0 -2
  13. scim2_models-0.4.2/.github/workflows/release.yml +0 -51
  14. scim2_models-0.4.2/.github/workflows/tests.yaml +0 -122
  15. scim2_models-0.4.2/.gitignore +0 -14
  16. scim2_models-0.4.2/.pre-commit-config.yaml +0 -31
  17. scim2_models-0.4.2/.readthedocs.yml +0 -15
  18. scim2_models-0.4.2/PKG-INFO +0 -280
  19. scim2_models-0.4.2/conftest.py +0 -12
  20. scim2_models-0.4.2/doc/changelog.rst +0 -371
  21. scim2_models-0.4.2/doc/conf.py +0 -102
  22. scim2_models-0.4.2/doc/contributing.rst +0 -47
  23. scim2_models-0.4.2/doc/index.rst +0 -15
  24. scim2_models-0.4.2/doc/reference.rst +0 -22
  25. scim2_models-0.4.2/doc/tutorial.rst +0 -451
  26. scim2_models-0.4.2/samples/rfc7643-8.1-user-minimal.json +0 -14
  27. scim2_models-0.4.2/samples/rfc7643-8.2-user-full.json +0 -113
  28. scim2_models-0.4.2/samples/rfc7643-8.3-enterprise_user.json +0 -126
  29. scim2_models-0.4.2/samples/rfc7643-8.4-group.json +0 -26
  30. scim2_models-0.4.2/samples/rfc7643-8.5-service_provider_configuration.json +0 -51
  31. scim2_models-0.4.2/samples/rfc7643-8.6-resource_type-group.json +0 -14
  32. scim2_models-0.4.2/samples/rfc7643-8.6-resource_type-user.json +0 -20
  33. scim2_models-0.4.2/samples/rfc7643-8.7.1-schema-enterprise_user.json +0 -114
  34. scim2_models-0.4.2/samples/rfc7643-8.7.1-schema-group.json +0 -86
  35. scim2_models-0.4.2/samples/rfc7643-8.7.1-schema-user.json +0 -781
  36. scim2_models-0.4.2/samples/rfc7643-8.7.2-schema-resource_type.json +0 -103
  37. scim2_models-0.4.2/samples/rfc7643-8.7.2-schema-schema.json +0 -347
  38. scim2_models-0.4.2/samples/rfc7643-8.7.2-schema-service_provider_configuration.json +0 -233
  39. scim2_models-0.4.2/samples/rfc7644-3.12-error-bad_request.json +0 -8
  40. scim2_models-0.4.2/samples/rfc7644-3.12-error-not_found.json +0 -5
  41. scim2_models-0.4.2/samples/rfc7644-3.14-user-post_request.json +0 -10
  42. scim2_models-0.4.2/samples/rfc7644-3.14-user-post_response.json +0 -17
  43. scim2_models-0.4.2/samples/rfc7644-3.3-user-post_request.json +0 -10
  44. scim2_models-0.4.2/samples/rfc7644-3.3-user-post_response.json +0 -19
  45. scim2_models-0.4.2/samples/rfc7644-3.4.1-user-known-resource.json +0 -31
  46. scim2_models-0.4.2/samples/rfc7644-3.4.2-list_response-partial_attributes.json +0 -14
  47. scim2_models-0.4.2/samples/rfc7644-3.4.3-list_response-post_query.json +0 -19
  48. scim2_models-0.4.2/samples/rfc7644-3.4.3-search_request.json +0 -12
  49. scim2_models-0.4.2/samples/rfc7644-3.5.1-user-put_request.json +0 -21
  50. scim2_models-0.4.2/samples/rfc7644-3.5.1-user-put_response.json +0 -27
  51. scim2_models-0.4.2/samples/rfc7644-3.5.2.1-patch_op-add_emails.json +0 -19
  52. scim2_models-0.4.2/samples/rfc7644-3.5.2.1-patch_op-add_members.json +0 -18
  53. scim2_models-0.4.2/samples/rfc7644-3.5.2.2-patch_op-remove_all_members.json +0 -11
  54. scim2_models-0.4.2/samples/rfc7644-3.5.2.2-patch_op-remove_and_add_one_member.json +0 -22
  55. scim2_models-0.4.2/samples/rfc7644-3.5.2.2-patch_op-remove_multi_complex_value.json +0 -11
  56. scim2_models-0.4.2/samples/rfc7644-3.5.2.2-patch_op-remove_one_member.json +0 -11
  57. scim2_models-0.4.2/samples/rfc7644-3.5.2.3-patch_op-replace_all_email_values.json +0 -24
  58. scim2_models-0.4.2/samples/rfc7644-3.5.2.3-patch_op-replace_all_members.json +0 -27
  59. scim2_models-0.4.2/samples/rfc7644-3.5.2.3-patch_op-replace_street_address.json +0 -12
  60. scim2_models-0.4.2/samples/rfc7644-3.5.2.3-patch_op-replace_user_work_address.json +0 -21
  61. scim2_models-0.4.2/samples/rfc7644-3.6-error-not_found.json +0 -7
  62. scim2_models-0.4.2/samples/rfc7644-3.7.1-bulk_request-circular_conflict.json +0 -41
  63. scim2_models-0.4.2/samples/rfc7644-3.7.1-list_response-circular_reference.json +0 -50
  64. scim2_models-0.4.2/samples/rfc7644-3.7.2-bulk_request-enterprise_user.json +0 -36
  65. scim2_models-0.4.2/samples/rfc7644-3.7.2-bulk_request-temporary_identifier.json +0 -35
  66. scim2_models-0.4.2/samples/rfc7644-3.7.2-bulk_response-temporary_identifier.json +0 -21
  67. scim2_models-0.4.2/samples/rfc7644-3.7.3-bulk_request-multiple_operations.json +0 -52
  68. scim2_models-0.4.2/samples/rfc7644-3.7.3-bulk_response-error_invalid_syntax.json +0 -20
  69. scim2_models-0.4.2/samples/rfc7644-3.7.3-bulk_response-multiple_errors.json +0 -56
  70. scim2_models-0.4.2/samples/rfc7644-3.7.3-bulk_response-multiple_operations.json +0 -31
  71. scim2_models-0.4.2/samples/rfc7644-3.7.3-error-invalid_syntax.json +0 -8
  72. scim2_models-0.4.2/samples/rfc7644-3.7.4-error-payload_too_large.json +0 -7
  73. scim2_models-0.4.2/samples/rfc7644-3.9-user-partial_response.json +0 -5
  74. scim2_models-0.4.2/samples/rfc7644-4-list_response-resource_types.json +0 -34
  75. scim2_models-0.4.2/scim2_models/resources/__init__.py +0 -0
  76. scim2_models-0.4.2/tests/__init__.py +0 -0
  77. scim2_models-0.4.2/tests/conftest.py +0 -12
  78. scim2_models-0.4.2/tests/test_dynamic_resources.py +0 -2783
  79. scim2_models-0.4.2/tests/test_dynamic_schemas.py +0 -200
  80. scim2_models-0.4.2/tests/test_enterprise_user.py +0 -120
  81. scim2_models-0.4.2/tests/test_errors.py +0 -17
  82. scim2_models-0.4.2/tests/test_group.py +0 -37
  83. scim2_models-0.4.2/tests/test_list_response.py +0 -242
  84. scim2_models-0.4.2/tests/test_model_attributes.py +0 -352
  85. scim2_models-0.4.2/tests/test_model_serialization.py +0 -428
  86. scim2_models-0.4.2/tests/test_model_validation.py +0 -551
  87. scim2_models-0.4.2/tests/test_models.py +0 -159
  88. scim2_models-0.4.2/tests/test_patch_op_add.py +0 -278
  89. scim2_models-0.4.2/tests/test_patch_op_extensions.py +0 -335
  90. scim2_models-0.4.2/tests/test_patch_op_remove.py +0 -289
  91. scim2_models-0.4.2/tests/test_patch_op_replace.py +0 -219
  92. scim2_models-0.4.2/tests/test_patch_op_validation.py +0 -499
  93. scim2_models-0.4.2/tests/test_path_validation.py +0 -112
  94. scim2_models-0.4.2/tests/test_reference.py +0 -80
  95. scim2_models-0.4.2/tests/test_resource_extension.py +0 -350
  96. scim2_models-0.4.2/tests/test_resource_type.py +0 -97
  97. scim2_models-0.4.2/tests/test_schema.py +0 -125
  98. scim2_models-0.4.2/tests/test_search_request.py +0 -243
  99. scim2_models-0.4.2/tests/test_service_provider_configuration.py +0 -64
  100. scim2_models-0.4.2/tests/test_user.py +0 -126
  101. scim2_models-0.4.2/tests/test_utils.py +0 -29
  102. scim2_models-0.4.2/uv.lock +0 -1403
  103. {scim2_models-0.4.2 → scim2_models-0.5.0}/LICENSE +0 -0
  104. {scim2_models-0.4.2 → scim2_models-0.5.0}/README.md +0 -0
  105. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/__init__.py +0 -0
  106. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/annotations.py +0 -0
  107. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/base.py +0 -0
  108. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/constants.py +0 -0
  109. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/context.py +0 -0
  110. {scim2_models-0.4.2/doc → scim2_models-0.5.0/scim2_models/messages}/__init__.py +0 -0
  111. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/messages/bulk.py +0 -0
  112. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/messages/error.py +0 -0
  113. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/messages/list_response.py +0 -0
  114. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/messages/message.py +0 -0
  115. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/messages/search_request.py +0 -0
  116. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/py.typed +0 -0
  117. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/reference.py +0 -0
  118. {scim2_models-0.4.2/scim2_models/messages → scim2_models-0.5.0/scim2_models/resources}/__init__.py +0 -0
  119. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/enterprise_user.py +0 -0
  120. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/resources/resource_type.py +0 -0
  121. {scim2_models-0.4.2 → scim2_models-0.5.0}/scim2_models/scim_object.py +0 -0
@@ -0,0 +1,280 @@
1
+ Metadata-Version: 2.3
2
+ Name: scim2-models
3
+ Version: 0.5.0
4
+ Summary: SCIM2 models serialization and validation with pydantic
5
+ Keywords: scim,scim2,provisioning,pydantic,rfc7643,rfc7644
6
+ Author: Yaal Coop
7
+ Author-email: Yaal Coop <contact@yaal.coop>
8
+ License: Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship, whether in Source or
43
+ Object form, made available under the License, as indicated by a
44
+ copyright notice that is included in or attached to the work
45
+ (an example is provided in the Appendix below).
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other modifications
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean any work of authorship, including
56
+ the original version of the Work and any modifications or additions
57
+ to that Work or Derivative Works thereof, that is intentionally
58
+ submitted to Licensor for inclusion in the Work by the copyright owner
59
+ or by an individual or Legal Entity authorized to submit on behalf of
60
+ the copyright owner. For the purposes of this definition, "submitted"
61
+ means any form of electronic, verbal, or written communication sent
62
+ to the Licensor or its representatives, including but not limited to
63
+ communication on electronic mailing lists, source code control systems,
64
+ and issue tracking systems that are managed by, or on behalf of, the
65
+ Licensor for the purpose of discussing and improving the Work, but
66
+ excluding communication that is conspicuously marked or otherwise
67
+ designated in writing by the copyright owner as "Not a Contribution."
68
+
69
+ "Contributor" shall mean Licensor and any individual or Legal Entity
70
+ on behalf of whom a Contribution has been received by Licensor and
71
+ subsequently incorporated within the Work.
72
+
73
+ 2. Grant of Copyright License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a
90
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
91
+ or a Contribution incorporated within the Work constitutes direct
92
+ or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate
94
+ as of the date such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, then any Derivative Works that You distribute must
115
+ include a readable copy of the attribution notices contained
116
+ within such NOTICE file, excluding those notices that do not
117
+ pertain to any part of the Derivative Works, in at least one
118
+ of the following places: within a NOTICE text file distributed
119
+ as part of the Derivative Works; within the Source form or
120
+ documentation, if provided along with the Derivative Works; or,
121
+ within a display generated by the Derivative Works, if and
122
+ wherever such third-party notices normally appear. The contents
123
+ of the NOTICE file are for informational purposes only and
124
+ do not modify the License. You may add Your own attribution
125
+ notices within Derivative Works that You distribute, alongside
126
+ or as an addendum to the NOTICE text from the Work, provided
127
+ that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+
137
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
138
+ any Contribution intentionally submitted for inclusion in the Work
139
+ by You to the Licensor shall be under the terms and conditions of
140
+ this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify
142
+ the terms of any separate license agreement you may have executed
143
+ with Licensor regarding such Contributions.
144
+
145
+ 6. Trademarks. This License does not grant permission to use the trade
146
+ names, trademarks, service marks, or product names of the Licensor,
147
+ except as required for reasonable and customary use in describing the
148
+ origin of the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty. Unless required by applicable law or
151
+ agreed to in writing, Licensor provides the Work (and each
152
+ Contributor provides its Contributions) on an "AS IS" BASIS,
153
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154
+ implied, including, without limitation, any warranties or conditions
155
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156
+ PARTICULAR PURPOSE. You are solely responsible for determining the
157
+ appropriateness of using or redistributing the Work and assume any
158
+ risks associated with Your exercise of permissions under this License.
159
+
160
+ 8. Limitation of Liability. In no event and under no legal theory,
161
+ whether in tort (including negligence), contract, or otherwise,
162
+ unless required by applicable law (such as deliberate and grossly
163
+ negligent acts) or agreed to in writing, shall any Contributor be
164
+ liable to You for damages, including any direct, indirect, special,
165
+ incidental, or consequential damages of any character arising as a
166
+ result of this License or out of the use or inability to use the
167
+ Work (including but not limited to damages for loss of goodwill,
168
+ work stoppage, computer failure or malfunction, or any and all
169
+ other commercial damages or losses), even if such Contributor
170
+ has been advised of the possibility of such damages.
171
+
172
+ 9. Accepting Warranty or Additional Liability. While redistributing
173
+ the Work or Derivative Works thereof, You may choose to offer,
174
+ and charge a fee for, acceptance of support, warranty, indemnity,
175
+ or other liability obligations and/or rights consistent with this
176
+ License. However, in accepting such obligations, You may act only
177
+ on Your own behalf and on Your sole responsibility, not on behalf
178
+ of any other Contributor, and only if You agree to indemnify,
179
+ defend, and hold each Contributor harmless for any liability
180
+ incurred by, or claims asserted against, such Contributor by reason
181
+ of your accepting any such warranty or additional liability.
182
+
183
+ END OF TERMS AND CONDITIONS
184
+
185
+ APPENDIX: How to apply the Apache License to your work.
186
+
187
+ To apply the Apache License to your work, attach the following
188
+ boilerplate notice, with the fields enclosed by brackets "[]"
189
+ replaced with your own identifying information. (Don't include
190
+ the brackets!) The text should be enclosed in the appropriate
191
+ comment syntax for the file format. We also recommend that a
192
+ file or class name and description of purpose be included on the
193
+ same "printed page" as the copyright notice for easier
194
+ identification within third-party archives.
195
+
196
+ Copyright [yyyy] [name of copyright owner]
197
+
198
+ Licensed under the Apache License, Version 2.0 (the "License");
199
+ you may not use this file except in compliance with the License.
200
+ You may obtain a copy of the License at
201
+
202
+ http://www.apache.org/licenses/LICENSE-2.0
203
+
204
+ Unless required by applicable law or agreed to in writing, software
205
+ distributed under the License is distributed on an "AS IS" BASIS,
206
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207
+ See the License for the specific language governing permissions and
208
+ limitations under the License.
209
+ Classifier: Intended Audience :: Developers
210
+ Classifier: Development Status :: 3 - Alpha
211
+ Classifier: Programming Language :: Python :: 3.9
212
+ Classifier: Programming Language :: Python :: 3.10
213
+ Classifier: Programming Language :: Python :: 3.11
214
+ Classifier: Programming Language :: Python :: 3.12
215
+ Classifier: Programming Language :: Python :: 3.13
216
+ Classifier: Programming Language :: Python :: Implementation :: CPython
217
+ Classifier: License :: OSI Approved :: Apache Software License
218
+ Classifier: Environment :: Web Environment
219
+ Classifier: Programming Language :: Python
220
+ Classifier: Operating System :: OS Independent
221
+ Requires-Dist: pydantic[email]>=2.7.0
222
+ Requires-Python: >=3.9
223
+ Project-URL: changelog, https://scim2-models.readthedocs.io/en/latest/changelog.html
224
+ Project-URL: documentation, https://scim2-models.readthedocs.io
225
+ Project-URL: funding, https://github.com/sponsors/python-scim
226
+ Project-URL: repository, https://github.com/python-scim/scim2-models
227
+ Description-Content-Type: text/markdown
228
+
229
+ # scim2-models
230
+
231
+ [Pydantic](https://docs.pydantic.dev) models for SCIM schemas defined in [RFC7643](https://datatracker.ietf.org/doc/html/rfc7643.html) and [RFC7644](https://datatracker.ietf.org/doc/html/rfc7644.html).
232
+
233
+ This library provides utilities to parse and produce SCIM2 payloads, and handle them with native Python objects.
234
+ It aims to be used as a basis to build SCIM2 servers and clients.
235
+
236
+ ## What's SCIM anyway?
237
+
238
+ SCIM stands for System for Cross-domain Identity Management, and it is a provisioning protocol.
239
+ Provisioning is the action of managing a set of resources across different services, usually users and groups.
240
+ SCIM is often used between Identity Providers and applications in completion of standards like OAuth2 and OpenID Connect.
241
+ It allows users and groups creations, modifications and deletions to be synchronized between applications.
242
+
243
+ ## Installation
244
+
245
+ ```shell
246
+ pip install scim2-models
247
+ ```
248
+
249
+ ## Usage
250
+
251
+ Check the [tutorial](https://scim2-models.readthedocs.io/en/latest/tutorial.html) and the [reference](https://scim2-models.readthedocs.io/en/latest/reference.html) for more details.
252
+
253
+ ```python
254
+ from scim2_models import User
255
+ import datetime
256
+
257
+ payload = {
258
+ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
259
+ "id": "2819c223-7f76-453a-919d-413861904646",
260
+ "userName": "bjensen@example.com",
261
+ "meta": {
262
+ "resourceType": "User",
263
+ "created": "2010-01-23T04:56:22Z",
264
+ "lastModified": "2011-05-13T04:42:34Z",
265
+ "version": 'W\\/"3694e05e9dff590"',
266
+ "location": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646",
267
+ },
268
+ }
269
+
270
+ user = User.model_validate(payload)
271
+ assert user.user_name == "bjensen@example.com"
272
+ assert user.meta.created == datetime.datetime(
273
+ 2010, 1, 23, 4, 56, 22, tzinfo=datetime.timezone.utc
274
+ )
275
+ ```
276
+
277
+ scim2-models belongs in a collection of SCIM tools developed by [Yaal Coop](https://yaal.coop),
278
+ with [scim2-client](https://github.com/python-scim/scim2-client),
279
+ [scim2-tester](https://github.com/python-scim/scim2-tester) and
280
+ [scim2-cli](https://github.com/python-scim/scim2-cli)
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
2
+ requires = ["uv_build>=0.8.9,<0.9.0"]
3
+ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scim2-models"
7
- version = "0.4.2"
7
+ version = "0.5.0"
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"}
@@ -36,6 +36,9 @@ repository = "https://github.com/python-scim/scim2-models"
36
36
  changelog = "https://scim2-models.readthedocs.io/en/latest/changelog.html"
37
37
  funding = "https://github.com/sponsors/python-scim"
38
38
 
39
+ [tool.uv.build-backend]
40
+ module-root = ""
41
+
39
42
  [dependency-groups]
40
43
  dev = [
41
44
  "mypy>=1.13.0",
@@ -152,6 +155,7 @@ commands = [
152
155
  [tool.tox.env.minversions]
153
156
  runner = "uv-venv-runner"
154
157
  uv_resolution = "lowest-direct"
158
+ base_python = ["3.10"]
155
159
 
156
160
  [tool.tox.env.doc]
157
161
  dependency_groups = ["doc"]
@@ -53,5 +53,5 @@ def is_complex_attribute(type_: type) -> bool:
53
53
  return (
54
54
  get_origin(type_) != Reference
55
55
  and isclass(type_)
56
- and issubclass(type_, (ComplexAttribute, MultiValuedComplexAttribute))
56
+ and issubclass(type_, ComplexAttribute)
57
57
  )
@@ -22,6 +22,7 @@ from ..resources.resource import Resource
22
22
  from ..urn import _resolve_path_to_target
23
23
  from ..utils import _extract_field_name
24
24
  from ..utils import _find_field_name
25
+ from ..utils import _get_path_parts
25
26
  from ..utils import _validate_scim_path_syntax
26
27
  from .error import Error
27
28
  from .message import Message
@@ -217,12 +218,17 @@ class PatchOp(Message, Generic[T]):
217
218
  "Operations", whose value is an array of one or more PATCH operations."""
218
219
 
219
220
  @model_validator(mode="after")
220
- def validate_operations(self) -> Self:
221
+ def validate_operations(self, info: ValidationInfo) -> Self:
221
222
  """Validate operations against resource type metadata if available.
222
223
 
223
224
  When PatchOp is used with a specific resource type (e.g., PatchOp[User]),
224
225
  this validator will automatically check mutability and required constraints.
225
226
  """
227
+ # RFC 7644: The body of an HTTP PATCH request MUST contain the attribute "Operations"
228
+ scim_ctx = info.context.get("scim") if info.context else None
229
+ if scim_ctx == Context.RESOURCE_PATCH_REQUEST and self.operations is None:
230
+ raise ValueError(Error.make_invalid_value_error().detail)
231
+
226
232
  resource_class = _get_resource_class(self)
227
233
  if resource_class is None or not self.operations:
228
234
  return self
@@ -334,10 +340,19 @@ class PatchOp(Message, Generic[T]):
334
340
  """Set a value at a specific path."""
335
341
  target, attr_path = _resolve_path_to_target(resource, path)
336
342
 
337
- if not attr_path or not target:
343
+ if not target:
338
344
  raise ValueError(Error.make_invalid_path_error().detail)
339
345
 
340
- path_parts = attr_path.split(".")
346
+ if not attr_path:
347
+ if not isinstance(value, dict):
348
+ raise ValueError(Error.make_invalid_path_error().detail)
349
+
350
+ updated_data = {**target.model_dump(), **value}
351
+ updated_target = type(target).model_validate(updated_data)
352
+ target.__dict__.update(updated_target.__dict__)
353
+ return True
354
+
355
+ path_parts = _get_path_parts(attr_path)
341
356
  if len(path_parts) == 1:
342
357
  return cls._set_simple_attribute(target, path_parts[0], value, is_add)
343
358
 
@@ -462,7 +477,7 @@ class PatchOp(Message, Generic[T]):
462
477
  if not attr_path or not target:
463
478
  raise ValueError(Error.make_invalid_path_error().detail)
464
479
 
465
- parent_attr, *path_parts = attr_path.split(".")
480
+ parent_attr, *path_parts = _get_path_parts(attr_path)
466
481
  field_name = _find_field_name(type(target), parent_attr)
467
482
  if not field_name:
468
483
  raise ValueError(Error.make_no_target_error().detail)
@@ -10,12 +10,11 @@ from pydantic import Field
10
10
  from ..annotations import Mutability
11
11
  from ..annotations import Required
12
12
  from ..attributes import ComplexAttribute
13
- from ..attributes import MultiValuedComplexAttribute
14
13
  from ..reference import Reference
15
14
  from .resource import Resource
16
15
 
17
16
 
18
- class GroupMember(MultiValuedComplexAttribute):
17
+ class GroupMember(ComplexAttribute):
19
18
  value: Annotated[Optional[str], Mutability.immutable] = None
20
19
  """Identifier of the member of this Group."""
21
20
 
@@ -22,7 +22,6 @@ from ..annotations import Required
22
22
  from ..annotations import Returned
23
23
  from ..annotations import Uniqueness
24
24
  from ..attributes import ComplexAttribute
25
- from ..attributes import MultiValuedComplexAttribute
26
25
  from ..attributes import is_complex_attribute
27
26
  from ..base import BaseModel
28
27
  from ..context import Context
@@ -437,10 +436,7 @@ def _model_attribute_to_scim_attribute(
437
436
  sub_attributes = (
438
437
  [
439
438
  _model_attribute_to_scim_attribute(root_type, sub_attribute_name)
440
- for sub_attribute_name in _dedicated_attributes(
441
- root_type,
442
- [MultiValuedComplexAttribute],
443
- )
439
+ for sub_attribute_name in root_type.model_fields # type: ignore
444
440
  if (
445
441
  attribute_name != "sub_attributes"
446
442
  or sub_attribute_name != "sub_attributes"
@@ -23,7 +23,6 @@ from ..annotations import Required
23
23
  from ..annotations import Returned
24
24
  from ..annotations import Uniqueness
25
25
  from ..attributes import ComplexAttribute
26
- from ..attributes import MultiValuedComplexAttribute
27
26
  from ..attributes import is_complex_attribute
28
27
  from ..base import BaseModel
29
28
  from ..constants import RESERVED_WORDS
@@ -49,7 +48,6 @@ def _make_python_identifier(identifier: str) -> str:
49
48
  def _make_python_model(
50
49
  obj: Union["Schema", "Attribute"],
51
50
  base: type[T],
52
- multiple: bool = False,
53
51
  ) -> type[T]:
54
52
  """Build a Python model from a Schema or an Attribute object."""
55
53
  if isinstance(obj, Attribute):
@@ -99,7 +97,6 @@ class Attribute(ComplexAttribute):
99
97
 
100
98
  def _to_python(
101
99
  self,
102
- multiple: bool = False,
103
100
  reference_types: Optional[list[str]] = None,
104
101
  ) -> type:
105
102
  if self.value == self.reference and reference_types is not None:
@@ -119,9 +116,7 @@ class Attribute(ComplexAttribute):
119
116
  self.integer: int,
120
117
  self.date_time: datetime,
121
118
  self.binary: Base64Bytes,
122
- self.complex: MultiValuedComplexAttribute
123
- if multiple
124
- else ComplexAttribute,
119
+ self.complex: ComplexAttribute,
125
120
  }
126
121
  return attr_types[self.value]
127
122
 
@@ -215,12 +210,10 @@ class Attribute(ComplexAttribute):
215
210
  if not self.name or not self.type:
216
211
  return None
217
212
 
218
- attr_type = self.type._to_python(bool(self.multi_valued), self.reference_types)
213
+ attr_type = self.type._to_python(self.reference_types)
219
214
 
220
- if attr_type in (ComplexAttribute, MultiValuedComplexAttribute):
221
- attr_type = _make_python_model(
222
- obj=self, base=attr_type, multiple=bool(self.multi_valued)
223
- )
215
+ if attr_type == ComplexAttribute:
216
+ attr_type = _make_python_model(obj=self, base=attr_type)
224
217
 
225
218
  if self.multi_valued:
226
219
  attr_type = list[attr_type] # type: ignore
@@ -38,7 +38,7 @@ class Filter(ComplexAttribute):
38
38
  """A Boolean value specifying whether or not the operation is supported."""
39
39
 
40
40
  max_results: Annotated[Optional[int], Mutability.read_only, Required.true] = None
41
- """A Boolean value specifying whether or not the operation is supported."""
41
+ """An integer value specifying the maximum number of resources returned in a response."""
42
42
 
43
43
 
44
44
  class ChangePassword(ComplexAttribute):
@@ -66,7 +66,7 @@ class AuthenticationScheme(ComplexAttribute):
66
66
 
67
67
  type: Annotated[Optional[Type], Mutability.read_only, Required.true] = Field(
68
68
  None,
69
- examples=["oauth", "oauth2", "oauthbreakertoken", "httpbasic", "httpdigest"],
69
+ examples=["oauth", "oauth2", "oauthbearertoken", "httpbasic", "httpdigest"],
70
70
  )
71
71
  """The authentication scheme."""
72
72
 
@@ -14,7 +14,6 @@ from ..annotations import Required
14
14
  from ..annotations import Returned
15
15
  from ..annotations import Uniqueness
16
16
  from ..attributes import ComplexAttribute
17
- from ..attributes import MultiValuedComplexAttribute
18
17
  from ..reference import ExternalReference
19
18
  from ..reference import Reference
20
19
  from ..utils import Base64Bytes
@@ -48,7 +47,7 @@ class Name(ComplexAttribute):
48
47
  languages (e.g., 'III' given the full name 'Ms. Barbara J Jensen, III')."""
49
48
 
50
49
 
51
- class Email(MultiValuedComplexAttribute):
50
+ class Email(ComplexAttribute):
52
51
  class Type(str, Enum):
53
52
  work = "work"
54
53
  home = "home"
@@ -69,7 +68,7 @@ class Email(MultiValuedComplexAttribute):
69
68
  address."""
70
69
 
71
70
 
72
- class PhoneNumber(MultiValuedComplexAttribute):
71
+ class PhoneNumber(ComplexAttribute):
73
72
  class Type(str, Enum):
74
73
  work = "work"
75
74
  home = "home"
@@ -96,7 +95,7 @@ class PhoneNumber(MultiValuedComplexAttribute):
96
95
  number."""
97
96
 
98
97
 
99
- class Im(MultiValuedComplexAttribute):
98
+ class Im(ComplexAttribute):
100
99
  class Type(str, Enum):
101
100
  aim = "aim"
102
101
  gtalk = "gtalk"
@@ -124,7 +123,7 @@ class Im(MultiValuedComplexAttribute):
124
123
  for this attribute, e.g., the preferred messenger or primary messenger."""
125
124
 
126
125
 
127
- class Photo(MultiValuedComplexAttribute):
126
+ class Photo(ComplexAttribute):
128
127
  class Type(str, Enum):
129
128
  photo = "photo"
130
129
  thumbnail = "thumbnail"
@@ -144,7 +143,7 @@ class Photo(MultiValuedComplexAttribute):
144
143
  for this attribute, e.g., the preferred photo or thumbnail."""
145
144
 
146
145
 
147
- class Address(MultiValuedComplexAttribute):
146
+ class Address(ComplexAttribute):
148
147
  class Type(str, Enum):
149
148
  work = "work"
150
149
  home = "home"
@@ -181,11 +180,22 @@ class Address(MultiValuedComplexAttribute):
181
180
  for this attribute, e.g., the preferred photo or thumbnail."""
182
181
 
183
182
 
184
- class Entitlement(MultiValuedComplexAttribute):
185
- pass
183
+ class Entitlement(ComplexAttribute):
184
+ value: Optional[str] = None
185
+ """The value of an entitlement."""
186
+
187
+ display: Optional[str] = None
188
+ """A human-readable name, primarily used for display purposes."""
189
+
190
+ type: Optional[str] = None
191
+ """A label indicating the attribute's function."""
192
+
193
+ primary: Optional[bool] = None
194
+ """A Boolean value indicating the 'primary' or preferred attribute value
195
+ for this attribute."""
186
196
 
187
197
 
188
- class GroupMembership(MultiValuedComplexAttribute):
198
+ class GroupMembership(ComplexAttribute):
189
199
  value: Annotated[Optional[str], Mutability.read_only] = None
190
200
  """The identifier of the User's group."""
191
201
 
@@ -206,14 +216,35 @@ class GroupMembership(MultiValuedComplexAttribute):
206
216
  'indirect'."""
207
217
 
208
218
 
209
- class Role(MultiValuedComplexAttribute):
210
- pass
219
+ class Role(ComplexAttribute):
220
+ value: Optional[str] = None
221
+ """The value of a role."""
222
+
223
+ display: Optional[str] = None
224
+ """A human-readable name, primarily used for display purposes."""
211
225
 
226
+ type: Optional[str] = None
227
+ """A label indicating the attribute's function."""
212
228
 
213
- class X509Certificate(MultiValuedComplexAttribute):
229
+ primary: Optional[bool] = None
230
+ """A Boolean value indicating the 'primary' or preferred attribute value
231
+ for this attribute."""
232
+
233
+
234
+ class X509Certificate(ComplexAttribute):
214
235
  value: Annotated[Optional[Base64Bytes], CaseExact.true] = None
215
236
  """The value of an X.509 certificate."""
216
237
 
238
+ display: Optional[str] = None
239
+ """A human-readable name, primarily used for display purposes."""
240
+
241
+ type: Optional[str] = None
242
+ """A label indicating the attribute's function."""
243
+
244
+ primary: Optional[bool] = None
245
+ """A Boolean value indicating the 'primary' or preferred attribute value
246
+ for this attribute."""
247
+
217
248
 
218
249
  class User(Resource[AnyExtension]):
219
250
  schemas: Annotated[list[str], Required.true] = [
@@ -4,6 +4,7 @@ from typing import Optional
4
4
  from typing import Union
5
5
 
6
6
  from .base import BaseModel
7
+ from .utils import _get_path_parts
7
8
  from .utils import _normalize_attribute_name
8
9
 
9
10
  if TYPE_CHECKING:
@@ -29,6 +30,16 @@ def _normalize_path(model: Optional[type["BaseModel"]], path: str) -> tuple[str,
29
30
 
30
31
  # Absolute URN
31
32
  if ":" in path:
33
+ if (
34
+ model
35
+ and issubclass(model, Resource)
36
+ and (
37
+ path in model.get_extension_models()
38
+ or path == model.model_fields["schemas"].default[0]
39
+ )
40
+ ):
41
+ return path, ""
42
+
32
43
  parts = path.rsplit(":", 1)
33
44
  return parts[0], parts[1]
34
45
 
@@ -42,7 +53,7 @@ def _normalize_path(model: Optional[type["BaseModel"]], path: str) -> tuple[str,
42
53
 
43
54
  def _validate_model_attribute(model: type["BaseModel"], attribute_base: str) -> None:
44
55
  """Validate that an attribute name or a sub-attribute path exist for a given model."""
45
- attribute_name, *sub_attribute_blocks = attribute_base.split(".")
56
+ attribute_name, *sub_attribute_blocks = _get_path_parts(attribute_base)
46
57
  sub_attribute_base = ".".join(sub_attribute_blocks)
47
58
 
48
59
  aliases = {field.validation_alias for field in model.model_fields.values()}
@@ -100,12 +111,17 @@ def _resolve_path_to_target(
100
111
  if not schema_urn:
101
112
  return resource, attr_path
102
113
 
114
+ if extension_class := resource.get_extension_model(schema_urn):
115
+ # Points to the extension root
116
+ if not attr_path:
117
+ return resource, extension_class.__name__
118
+
119
+ extension_instance = _get_or_create_extension_instance(
120
+ resource, extension_class
121
+ )
122
+ return extension_instance, attr_path
123
+
103
124
  if schema_urn in resource.schemas:
104
125
  return resource, attr_path
105
126
 
106
- extension_class = resource.get_extension_model(schema_urn)
107
- if not extension_class:
108
- return (None, "")
109
-
110
- extension_instance = _get_or_create_extension_instance(resource, extension_class)
111
- return extension_instance, attr_path
127
+ return (None, "")
@@ -195,3 +195,7 @@ def _find_field_name(model_class: type["BaseModel"], attr_name: str) -> Optional
195
195
  return field_key
196
196
 
197
197
  return None
198
+
199
+
200
+ def _get_path_parts(path: str) -> list[str]:
201
+ return path.split(".")
@@ -1,2 +0,0 @@
1
- ---
2
- github: [yaal-coop]