@@ -66,7 +66,7 @@ class AddPydanticModel(PydanticModel):
66
66
AfterValidator (images_format_check ),
67
67
]
68
68
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
70
70
deprecation_list : Annotated [
71
71
Optional [List [str ]],
72
72
AfterValidator (get_unique_deprecation_list_items ),
@@ -123,6 +123,7 @@ def bundles_needed_with_check_related_images(self) -> 'AddPydanticModel':
123
123
def get_json_for_request (self ):
124
124
"""Return json with the parameters we store in the db."""
125
125
return self .model_dump (
126
+ # include=["deprecation_list"],
126
127
exclude = [
127
128
"add_arches" ,
128
129
"build_tags" ,
@@ -131,7 +132,7 @@ def get_json_for_request(self):
131
132
"overwrite_from_index" ,
132
133
"overwrite_from_index_token" ,
133
134
],
134
- exclude_defaults = True ,
135
+ exclude_none = True ,
135
136
)
136
137
137
138
@@ -167,7 +168,7 @@ def get_json_for_request(self):
167
168
"""Return json with the parameters we store in the db."""
168
169
return self .model_dump (
169
170
exclude = ["add_arches" , "build_tags" , "overwrite_from_index" , "overwrite_from_index_token" ],
170
- exclude_defaults = True ,
171
+ exclude_none = True ,
171
172
)
172
173
173
174
def _get_all_keys_to_check_in_db (self ):
@@ -191,7 +192,7 @@ class RegenerateBundlePydanticModel(PydanticModel):
191
192
"""Datastructure of the request to /builds/regenerate-bundle API point."""
192
193
193
194
# BUNDLE_IMAGE, from_bundle_image_resolved, build_tags?
194
- bundle_replacements : Optional [Dict [str , str ]] = {}
195
+ bundle_replacements : Optional [Dict [str , str ]] = None
195
196
from_bundle_image : Annotated [str , AfterValidator (image_format_check )]
196
197
organization : Optional [str ] = None
197
198
registry_auths : Optional [RegistryAuths ] = None # not in db
@@ -200,7 +201,7 @@ def get_json_for_request(self):
200
201
"""Return json with the parameters we store in the db."""
201
202
return self .model_dump (
202
203
exclude = ["registry_auths" ],
203
- exclude_defaults = True ,
204
+ exclude_none = True ,
204
205
)
205
206
206
207
def _get_all_keys_to_check_in_db (self ):
@@ -255,7 +256,7 @@ def get_json_for_request(self):
255
256
"""Return json with the parameters we store in the db."""
256
257
return self .model_dump (
257
258
exclude = ["build_tags" , "overwrite_target_index" , "overwrite_target_index_token" ],
258
- exclude_defaults = True ,
259
+ exclude_none = True ,
259
260
)
260
261
261
262
def _get_all_keys_to_check_in_db (self ):
@@ -275,13 +276,13 @@ class CreateEmptyIndexPydanticModel(PydanticModel):
275
276
AfterValidator (image_format_check ),
276
277
AfterValidator (length_validator ),
277
278
]
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
280
281
281
282
def get_json_for_request (self ):
282
283
"""Return json with the parameters we store in the db."""
283
284
return self .model_dump (
284
- exclude_defaults = True ,
285
+ exclude_none = True ,
285
286
)
286
287
287
288
def _get_all_keys_to_check_in_db (self ):
@@ -301,7 +302,7 @@ def get_json_for_request(self):
301
302
"""Return json with the parameters we store in the db."""
302
303
return self .model_dump (
303
304
exclude = ["registry_auths" ],
304
- exclude_defaults = True ,
305
+ exclude_none = True ,
305
306
)
306
307
307
308
@@ -321,7 +322,7 @@ class FbcOperationsPydanticModel(PydanticModel):
321
322
AfterValidator (length_validator ),
322
323
AfterValidator (get_unique_bundles ),
323
324
AfterValidator (images_format_check ),
324
- ] = []
325
+ ] = None # old request without this parameter will not have empty list but None
325
326
build_tags : Optional [List [str ]] = []
326
327
distribution_scope : Annotated [
327
328
Optional [DISTRIBUTION_SCOPE_LITERAL ], BeforeValidator (distribution_scope_lower ),
@@ -349,7 +350,7 @@ def get_json_for_request(self):
349
350
"""Return json with the parameters we store in the db."""
350
351
return self .model_dump (
351
352
exclude = ["add_arches" , "build_tags" , "overwrite_from_index" , "overwrite_from_index_token" ],
352
- exclude_defaults = True ,
353
+ exclude_none = True ,
353
354
)
354
355
355
356
def _get_all_keys_to_check_in_db (self ):
0 commit comments