mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-11-01 10:37:48 +00:00
merge-schema.py: traverse anyOf/oneOf/allOf sub schemas
Properly compile alternative sub schemas to ensure that schema references are properly substituted. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
committed by
John Crispin
parent
7072d2949f
commit
1fda79f088
@@ -36,6 +36,13 @@ def schema_compile(input, output, definitions, tiny):
|
||||
output["$ref"] = "#/$defs/{}".format(name)
|
||||
elif k == "$ref" and not tiny:
|
||||
output["properties"] = {"reference": {"type": "string"}}
|
||||
elif k == "anyOf" or k == "oneOf" or k == "allOf":
|
||||
r = []
|
||||
for v in input[k]:
|
||||
o = {}
|
||||
schema_compile(v, o, definitions, tiny)
|
||||
r.append(o)
|
||||
output[k] = r
|
||||
else:
|
||||
output[k] = input[k]
|
||||
return output
|
||||
|
||||
Reference in New Issue
Block a user