Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions helpers/merge_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import yaml

def merge_dict(d1, d2):
for key, value in d2.items():
if key in d1 and isinstance(value, dict):
merge_dict(d1[key], value)
else:
d1[key] = value

openapi1 = {}

output_dir = 'output'
if not os.path.exists(output_dir):
os.makedirs(output_dir)

for filename in os.listdir('.'):
if filename.endswith('.yaml'):
with open(filename, 'r') as file:
openapi = yaml.safe_load(file)
merge_dict(openapi1, openapi)

output_file = os.path.join(output_dir, 'merged.yaml')
with open(output_file, 'w') as outfile:
yaml.safe_dump(openapi1, outfile)
Loading