From b65a3ab770b7400d02fe6de4a3a3cba084cae774 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 17 Oct 2024 16:28:46 +0200 Subject: [PATCH] add version field check --- .../validate_format.py | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/bioimageio_collection_backoffice/validate_format.py b/bioimageio_collection_backoffice/validate_format.py index 4192b7f..2573aef 100644 --- a/bioimageio_collection_backoffice/validate_format.py +++ b/bioimageio_collection_backoffice/validate_format.py @@ -91,19 +91,40 @@ def _validate_format_impl(rdf_source: str): ), ) ) + rd.validation_summary.add_detail( + ValidationDetail( + name="Check version field", + status="failed" if rd.version is None else "passed", + errors=( + [ + ErrorEntry( + loc=("version",), + msg="missing version (We encourage using '0.1.0' for the initial version.)", + type="error", + ) + ] + if rd.uploader is None + else [] + ), + ) + ) if rd.license is None: # some older RDF specs have 'license' as an optional field rd.validation_summary.add_detail( ValidationDetail( name="Check that RDF has a license field", status="failed" if rd.license is None else "passed", - errors=[ - ErrorEntry( - loc=("license",), - msg="missing license field", - type="error", - ) - ], + errors=( + [ + ErrorEntry( + loc=("license",), + msg="missing license field", + type="error", + ) + ] + if rd.license is None + else [] + ), ) )