Skip to content

Commit 7123e63

Browse files
committed
Fix differences to iib without Pydantic
1 parent c7f8c8d commit 7123e63

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

iib/common/pydantic_models.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class AddPydanticModel(PydanticModel):
6666
AfterValidator(images_format_check),
6767
]
6868
cnr_token: Optional[SecretStr] = None # deprecated
69-
check_related_images: Optional[bool] = False
69+
check_related_images: Optional[bool] = None # old request without this parameter will not have False but None
7070
deprecation_list: Annotated[
7171
Optional[List[str]],
7272
AfterValidator(get_unique_deprecation_list_items),
@@ -123,6 +123,7 @@ def bundles_needed_with_check_related_images(self) -> 'AddPydanticModel':
123123
def get_json_for_request(self):
124124
"""Return json with the parameters we store in the db."""
125125
return self.model_dump(
126+
# include=["deprecation_list"],
126127
exclude=[
127128
"add_arches",
128129
"build_tags",
@@ -131,7 +132,7 @@ def get_json_for_request(self):
131132
"overwrite_from_index",
132133
"overwrite_from_index_token",
133134
],
134-
exclude_defaults=True,
135+
exclude_none=True,
135136
)
136137

137138

@@ -167,7 +168,7 @@ def get_json_for_request(self):
167168
"""Return json with the parameters we store in the db."""
168169
return self.model_dump(
169170
exclude=["add_arches", "build_tags", "overwrite_from_index", "overwrite_from_index_token"],
170-
exclude_defaults=True,
171+
exclude_none=True,
171172
)
172173

173174
def _get_all_keys_to_check_in_db(self):
@@ -191,7 +192,7 @@ class RegenerateBundlePydanticModel(PydanticModel):
191192
"""Datastructure of the request to /builds/regenerate-bundle API point."""
192193

193194
# BUNDLE_IMAGE, from_bundle_image_resolved, build_tags?
194-
bundle_replacements: Optional[Dict[str, str]] = {}
195+
bundle_replacements: Optional[Dict[str, str]] = None
195196
from_bundle_image: Annotated[str, AfterValidator(image_format_check)]
196197
organization: Optional[str] = None
197198
registry_auths: Optional[RegistryAuths] = None # not in db
@@ -200,7 +201,7 @@ def get_json_for_request(self):
200201
"""Return json with the parameters we store in the db."""
201202
return self.model_dump(
202203
exclude=["registry_auths"],
203-
exclude_defaults=True,
204+
exclude_none=True,
204205
)
205206

206207
def _get_all_keys_to_check_in_db(self):
@@ -255,7 +256,7 @@ def get_json_for_request(self):
255256
"""Return json with the parameters we store in the db."""
256257
return self.model_dump(
257258
exclude=["build_tags", "overwrite_target_index", "overwrite_target_index_token"],
258-
exclude_defaults=True,
259+
exclude_none=True,
259260
)
260261

261262
def _get_all_keys_to_check_in_db(self):
@@ -275,13 +276,13 @@ class CreateEmptyIndexPydanticModel(PydanticModel):
275276
AfterValidator(image_format_check),
276277
AfterValidator(length_validator),
277278
]
278-
labels: Optional[Dict[str, str]] = {}
279-
output_fbc: Optional[bool] = False
279+
labels: Optional[Dict[str, str]] = None # old request without this parameter will not have empty labels
280+
output_fbc: Optional[bool] = None # old request without this parameter will not have empty output_fbc
280281

281282
def get_json_for_request(self):
282283
"""Return json with the parameters we store in the db."""
283284
return self.model_dump(
284-
exclude_defaults=True,
285+
exclude_none=True,
285286
)
286287

287288
def _get_all_keys_to_check_in_db(self):
@@ -301,7 +302,7 @@ def get_json_for_request(self):
301302
"""Return json with the parameters we store in the db."""
302303
return self.model_dump(
303304
exclude=["registry_auths"],
304-
exclude_defaults=True,
305+
exclude_none=True,
305306
)
306307

307308

@@ -321,7 +322,7 @@ class FbcOperationsPydanticModel(PydanticModel):
321322
AfterValidator(length_validator),
322323
AfterValidator(get_unique_bundles),
323324
AfterValidator(images_format_check),
324-
] = []
325+
] = None # old request without this parameter will not have empty list but None
325326
build_tags: Optional[List[str]] = []
326327
distribution_scope: Annotated[
327328
Optional[DISTRIBUTION_SCOPE_LITERAL], BeforeValidator(distribution_scope_lower),
@@ -349,7 +350,7 @@ def get_json_for_request(self):
349350
"""Return json with the parameters we store in the db."""
350351
return self.model_dump(
351352
exclude=["add_arches", "build_tags", "overwrite_from_index", "overwrite_from_index_token"],
352-
exclude_defaults=True,
353+
exclude_none=True,
353354
)
354355

355356
def _get_all_keys_to_check_in_db(self):

iib/web/api_v1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,6 @@ def fbc_operations() -> Tuple[flask.Response, int]:
11531153

11541154
request = RequestFbcOperations.from_json_replacement(
11551155
payload=request_payload,
1156-
batch_disabled=True,
11571156
build_tags_allowed=True,
11581157
)
11591158

0 commit comments

Comments
 (0)