mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-20 18:37:01 +00:00
Merge pull request #72 from tarioch/feature/handle_items_in_openapi2jsonschema
Also support items elements in yaml
This commit is contained in:
commit
dcc77ac3a3
1 changed files with 6 additions and 0 deletions
|
|
@ -113,14 +113,20 @@ for crdFile in sys.argv[1:]:
|
||||||
else:
|
else:
|
||||||
f = open(crdFile)
|
f = open(crdFile)
|
||||||
with f:
|
with f:
|
||||||
|
defs = []
|
||||||
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
|
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
|
||||||
if y is None:
|
if y is None:
|
||||||
continue
|
continue
|
||||||
|
if "items" in y:
|
||||||
|
defs.extend(y["items"])
|
||||||
if "kind" not in y:
|
if "kind" not in y:
|
||||||
continue
|
continue
|
||||||
if y["kind"] != "CustomResourceDefinition":
|
if y["kind"] != "CustomResourceDefinition":
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
defs.append(y)
|
||||||
|
|
||||||
|
for y in defs:
|
||||||
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
|
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
|
||||||
filename = ""
|
filename = ""
|
||||||
if "spec" in y and "versions" in y["spec"] and y["spec"]["versions"]:
|
if "spec" in y and "versions" in y["spec"] and y["spec"]["versions"]:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue