scim2-models 0.3.0__py3-none-any.whl → 0.3.1__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.
@@ -104,7 +104,13 @@ class ListResponse(Message, Generic[AnyResource], metaclass=ListResponseMetaclas
104
104
  def check_results_number(
105
105
  cls, value: Any, handler: ValidatorFunctionWrapHandler, info: ValidationInfo
106
106
  ) -> Self:
107
- """:rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>` indicates that 'resources' must be set if 'totalResults' is non-zero."""
107
+ """Validate result numbers.
108
+
109
+ :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>` indicates that:
110
+
111
+ - 'totalResults' is required
112
+ - 'resources' must be set if 'totalResults' is non-zero.
113
+ """
108
114
  obj = handler(value)
109
115
 
110
116
  if (
@@ -114,6 +120,12 @@ class ListResponse(Message, Generic[AnyResource], metaclass=ListResponseMetaclas
114
120
  ):
115
121
  return obj
116
122
 
123
+ if obj.total_results is None:
124
+ raise PydanticCustomError(
125
+ "required_error",
126
+ "Field 'total_results' is required but value is missing or null",
127
+ )
128
+
117
129
  if obj.total_results > 0 and not obj.resources:
118
130
  raise PydanticCustomError(
119
131
  "no_resource_error",
@@ -49,11 +49,11 @@ class SearchRequest(Message):
49
49
  @field_validator("start_index")
50
50
  @classmethod
51
51
  def start_index_floor(cls, value: int) -> int:
52
- """According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, start_index values less than 0 are interpreted as 0.
52
+ """According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, start_index values less than 1 are interpreted as 1.
53
53
 
54
54
  A value less than 1 SHALL be interpreted as 1.
55
55
  """
56
- return None if value is None else max(0, value)
56
+ return None if value is None else max(1, value)
57
57
 
58
58
  count: Optional[int] = None
59
59
  """An integer indicating the desired maximum number of query results per
@@ -62,11 +62,11 @@ class SearchRequest(Message):
62
62
  @field_validator("count")
63
63
  @classmethod
64
64
  def count_floor(cls, value: int) -> int:
65
- """According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, count values less than 1 are interpreted as 1.
65
+ """According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, count values less than 0 are interpreted as 0.
66
66
 
67
- A value less than 1 SHALL be interpreted as 1.
67
+ A negative value SHALL be interpreted as 0.
68
68
  """
69
- return None if value is None else max(1, value)
69
+ return None if value is None else max(0, value)
70
70
 
71
71
  @model_validator(mode="after")
72
72
  def attributes_validator(self):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: scim2-models
3
- Version: 0.3.0
3
+ Version: 0.3.1
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
@@ -208,6 +208,7 @@ License: Apache License
208
208
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
209
  See the License for the specific language governing permissions and
210
210
  limitations under the License.
211
+ License-File: LICENSE
211
212
  Keywords: provisioning,pydantic,rfc7643,rfc7644,scim,scim2
212
213
  Classifier: Development Status :: 3 - Alpha
213
214
  Classifier: Environment :: Web Environment
@@ -14,11 +14,11 @@ scim2_models/rfc7643/user.py,sha256=-wlO2IC0MxFWUJpaddEwAG5LsEcORnbHfkRwGG3fVSk,
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
17
- scim2_models/rfc7644/list_response.py,sha256=Zh8Od2iOd3kinwLP-PHQMEbfM1tdl111Qap9DR8DHc4,4251
17
+ scim2_models/rfc7644/list_response.py,sha256=ltjV1WII2fNy8j3RX8J0_Jb5DW4hTFoO6P-Myr7TnBY,4551
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
- scim2_models/rfc7644/search_request.py,sha256=X3DZQOtLu8EWYvkNfNOcFlGtx3TGNEkpL59dAdut7Sc,3006
21
- scim2_models-0.3.0.dist-info/METADATA,sha256=x9_m3LiXvIdc960TZyPyhlnq4KaEXwfEaZOfXlQByEc,16266
22
- scim2_models-0.3.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
23
- scim2_models-0.3.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- scim2_models-0.3.0.dist-info/RECORD,,
20
+ scim2_models/rfc7644/search_request.py,sha256=DRGlixcWtYtbUuP9MT7PsnvyxlONLcXGEcQveWdqQng,3003
21
+ scim2_models-0.3.1.dist-info/METADATA,sha256=UMsrXnMlvGREPr8wUwJ_MSnlBDDvLOa3YBmDPlt8x_M,16288
22
+ scim2_models-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ scim2_models-0.3.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ scim2_models-0.3.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any