Merge pull request #72 from tarioch/feature/handle_items_in_openapi2jsonschema

Also support items elements in yaml
This commit is contained in:
Yann Hamon 2021-09-26 14:07:52 +02:00 committed by GitHub
commit dcc77ac3a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,14 +113,20 @@ for crdFile in sys.argv[1:]:
else:
f = open(crdFile)
with f:
defs = []
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
if y is None:
continue
if "items" in y:
defs.extend(y["items"])
if "kind" not in y:
continue
if y["kind"] != "CustomResourceDefinition":
continue
else:
defs.append(y)
for y in defs:
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
filename = ""
if "spec" in y and "versions" in y["spec"] and y["spec"]["versions"]: