From 3d1c24fdc00607dd55c973316cc801f0784f0afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 2 Nov 2022 20:26:08 +0100 Subject: [PATCH] Hub: use `anyOf` for upload_options schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It turned out, that the upload options for AWS EC2 or GCP with just the required properties specified, would match both schemas. This is causing the validation fail with `oneOf` used for `upload_options`. This will be fixed in osbuild-composer PR#3018. However, we can't use the same approach for koji-osbuild, while keeping the schema backward compatible and sane. Another discussed option would be to define `upload_options` as an empty object with `additionalProperties` set to `True`. This would effectively mean no validation of `upload_options`. None of the plugins actually modify the `upload_options` in any way. It is passed as provided to `osbuild-composer`. I think that the change in this commit is a compromise. The validation of the `upload_options` schema is kept, but it is relaxed to `anyOf`. [1] https://github.com/osbuild/osbuild-composer/pull/3018 Signed-off-by: Tomáš Hozza --- plugins/hub/osbuild.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/hub/osbuild.py b/plugins/hub/osbuild.py index 20de306..2b2d109 100644 --- a/plugins/hub/osbuild.py +++ b/plugins/hub/osbuild.py @@ -112,7 +112,9 @@ OSBUILD_IMAGE_SCHEMA = { "$ref": "#/definitions/ostree" }, "upload_options": { - "oneOf": [ + # this should be really 'oneOf', but the minimal required + # properties in AWSEC2 and GCP options overlap. + "anyOf": [ {"$ref": "#/definitions/AWSEC2UploadOptions"}, {"$ref": "#/definitions/AWSS3UploadOptions"}, {"$ref": "#/definitions/GCPUploadOptions"},