File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -233,18 +233,22 @@ def load(
233233 with all_warnings_context :
234234 _ , _ , val_warnings = cls ._load_impl (deepcopy_yaml_value (data ))
235235
236+ format_status = "failed" if errors else "passed"
236237 rd .validation_summary .add_detail (
237238 ValidationDetail (
238239 errors = errors ,
239240 name = (
240241 "bioimageio.spec format validation"
241242 f" { rd .type } { cls .implemented_format_version } "
242243 ),
243- status = "failed" if errors else "passed" ,
244+ status = format_status ,
244245 warnings = val_warnings ,
245- context = context . summary , # context for format validation detail is identical
246- )
246+ ),
247+ update_status = False , # avoid updating status from 'valid-format' to 'passed', but ...
247248 )
249+ if format_status == "failed" :
250+ # ... update status in case of failure
251+ rd .validation_summary .status = "failed"
248252
249253 return rd
250254
Original file line number Diff line number Diff line change @@ -381,14 +381,15 @@ def display(
381381 include_conda_list = include_conda_list ,
382382 )
383383
384- def add_detail (self , detail : ValidationDetail ):
385- if self .status == "valid-format" and detail .status == "passed" :
386- # once status is valid-format we can only improve to 'passed'
387- self .status = "passed"
388- elif self .status == "passed" and detail .status == "failed" :
389- # once status is passed it can only degrade to 'valid-format'
390- self .status = "valid-format"
391- # once format is 'failed' it cannot improve (valid-format is set at summary creation)
384+ def add_detail (self , detail : ValidationDetail , update_status : bool = True ):
385+ if update_status :
386+ if self .status == "valid-format" and detail .status == "passed" :
387+ # once status is 'valid-format' we can only improve to 'passed'
388+ self .status = "passed"
389+ elif self .status == "passed" and detail .status == "failed" :
390+ # once status is 'passed' it can only degrade to 'valid-format'
391+ self .status = "valid-format"
392+ # once format is 'failed' it cannot improve
392393
393394 self .details .append (detail )
394395
You can’t perform that action at this time.
0 commit comments