From 2b19e534e6d0b11ee67f83f12e2b8406132e1522 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 26 May 2021 12:45:11 +0000 Subject: [PATCH] inputs/files: extract sources definition Make the main portion of the schema more readable by extracting the two possible reference definitions. --- inputs/org.osbuild.files | 43 ++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/inputs/org.osbuild.files b/inputs/org.osbuild.files index ef75ac3f..5dc2d90f 100755 --- a/inputs/org.osbuild.files +++ b/inputs/org.osbuild.files @@ -34,6 +34,26 @@ SCHEMA = r""" "additionalProperties": false } } + }, + "plain-ref": { + "type": "array", + "items": { + "type": "string" + } + }, + "object-ref": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": false, + "properties": { + "metadata": {"$ref": "#/definitions/metadata"} + } + } + } } }, "required": ["type", "origin", "references"], @@ -48,25 +68,10 @@ SCHEMA = r""" }, "references": { "description": "Checksums of files to use as files input", - "oneOf": [{ - "type": "array", - "items": { - "type": "string" - } - }, { - "type": "object", - "additionalProperties": false, - "minProperties": 1, - "patternProperties": { - ".*": { - "type": "object", - "additionalProperties": false, - "properties": { - "metadata": {"$ref": "#/definitions/metadata"} - } - } - } - }] + "oneOf": [ + {"$ref": "#/definitions/plain-ref"}, + {"$ref": "#/definitions/object-ref"} + ] } } """