stage: schema allows for any of schema/schema_2

Instead of requiring only one of the properties to be present require at
least one of them being present; some stages specify both schema
versions (`org.osbuild.rpm`)
This commit is contained in:
Simon de Vlieger 2024-03-14 13:55:13 +01:00 committed by Achilleas Koutsou
parent a9f4024ded
commit 8f7d029e9f
2 changed files with 21 additions and 10 deletions

View file

@ -284,16 +284,32 @@ META_JSON_SCHEMA = {
},
},
"required": ["summary", "description"],
"oneOf": [
"anyOf": [
{
"required": [
"schema"
]
],
"not": {
"required": [
"schema_2",
],
},
},
{
"required": [
"schema_2"
]
],
"not": {
"required": [
"schema",
],
},
},
{
"required": [
"schema",
"schema_2",
],
},
],
"properties": {

View file

@ -317,7 +317,8 @@ def test_load_from_json_prefered(tmp_path):
{"summary": "some", "description": ["many", "strings"], "schema": {}}, ""), (
{"summary": "some", "description": ["many", "strings"], "schema_2": {}}, ""), (
{"summary": "some", "description": ["many", "strings"], "schema_2": {}, "capabilities": []}, ""), (
{"summary": "some", "description": ["many", "strings"], "schema_2": {}, "capabilities": ["cap1", "cap2"]}, ""),
{"summary": "some", "description": ["many", "strings"], "schema_2": {}, "capabilities": ["cap1", "cap2"]}, ""), (
{"summary": "some", "description": ["many", "strings"], "schema": {}, "schema_2": {}, "capabilities": ["cap1", "cap2"]}, ""),
# unhappy
(
# no description
@ -331,12 +332,6 @@ def test_load_from_json_prefered(tmp_path):
# schema{,_2} missing
{"summary": "some", "description": ["many", "strings"]},
" is not valid",
),
(
# both schema{,_2}
{"summary": "some", "description": ["many", "strings"],
"schema": {}, "schema_2": {}},
" is valid under each ",
), (
# capabilities of wrong type
{"summary": "some", "description": ["many", "strings"], "schema": {},