inputs/files: extract sources definition

Make the main portion of the schema more readable by extracting the
two possible reference definitions.
This commit is contained in:
Christian Kellner 2021-05-26 12:45:11 +00:00 committed by Tom Gundersen
parent d577a306f9
commit 2b19e534e6

View file

@ -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"}
]
}
}
"""