Skip to content

Commit dcc77ac

Browse files
authored
Merge pull request #72 from tarioch/feature/handle_items_in_openapi2jsonschema
Also support items elements in yaml
2 parents f8dcb19 + 9228dba commit dcc77ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/openapi2jsonschema.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,20 @@ def write_schema_file(schema, filename):
113113
else:
114114
f = open(crdFile)
115115
with f:
116+
defs = []
116117
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
117118
if y is None:
118119
continue
120+
if "items" in y:
121+
defs.extend(y["items"])
119122
if "kind" not in y:
120123
continue
121124
if y["kind"] != "CustomResourceDefinition":
122125
continue
126+
else:
127+
defs.append(y)
123128

129+
for y in defs:
124130
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
125131
filename = ""
126132
if "spec" in y and "versions" in y["spec"] and y["spec"]["versions"]:

0 commit comments

Comments
 (0)