Skip to content

Commit 2785819

Browse files
committed
fix: remove trailing space from specs
Signed-off-by: Sébastien Han <[email protected]>
1 parent bb34f7a commit 2785819

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/openapi_generator/schema_transforms.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,16 @@ def _write_yaml_file(file_path: Path, schema: dict[str, Any]) -> None:
810810
with open(file_path, "w") as f:
811811
yaml.dump(schema, f, default_flow_style=False, sort_keys=False)
812812

813+
# Post-process to remove trailing whitespace from all lines
814+
with open(file_path) as f:
815+
lines = f.readlines()
816+
817+
# Strip trailing whitespace from each line, preserving newlines
818+
cleaned_lines = [line.rstrip() + "\n" if line.endswith("\n") else line.rstrip() for line in lines]
819+
820+
with open(file_path, "w") as f:
821+
f.writelines(cleaned_lines)
822+
813823

814824
def _fix_schema_issues(openapi_schema: dict[str, Any]) -> dict[str, Any]:
815825
"""Fix common schema issues: exclusiveMinimum, null defaults, and add titles to unions."""

0 commit comments

Comments
 (0)