Skip to content

Commit 0a8ef7d

Browse files
committed
Improve diff
1 parent 5e41093 commit 0a8ef7d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

diff-rest-api-spec.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def remove_descriptions(key, obj):
4545
"""Recursively remove 'description' fields from JSON object."""
4646
if isinstance(obj, dict):
4747
return {
48-
k: remove_descriptions(k, v) for k, v in obj.items() if k != "description"
48+
k: remove_descriptions(k, v) for k, v in obj.items() if k != "description" and k != "feature_flag"
4949
}
5050
elif isinstance(obj, list):
5151
if key == "options":
@@ -135,18 +135,15 @@ def main():
135135
relative_path = spec_file.relative_to(spec_dir)
136136
output_file = output_dir / relative_path
137137

138-
print(f"Comparing: {relative_path}")
139138
diff = compare_json_files(spec_file, output_file)
140139

141140
if diff:
142141
print(f"✗ Differences found in {relative_path}")
143142
for line in diff:
144143
print(line.rstrip("\n"))
145-
if line.startswith("+") or line.startswith("-"):
144+
if line.startswith("+ ") or line.startswith("- "):
146145
total_diffs += 1
147146
print("-" * 80)
148-
else:
149-
print(f"✓ No differences in {relative_path}")
150147

151148
print(f"\nTotal differences found: {total_diffs}")
152149

0 commit comments

Comments
 (0)