Skip to content

fix: Keep trailing newlines in generated files. #654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 13, 2022
Merged
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
2 changes: 1 addition & 1 deletion end_to_end_tests/golden-record/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ dmypy.json
.idea/

/coverage.xml
/.coverage
/.coverage
2 changes: 1 addition & 1 deletion end_to_end_tests/golden-record/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ If you want to install this client into another project without publishing it (e
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
1. If that project is not using Poetry:
1. Build a wheel with `poetry build -f wheel`
1. Install that wheel from the other project `pip install <path-to-wheel>`
1. Install that wheel from the other project `pip install <path-to-wheel>`
2 changes: 1 addition & 1 deletion end_to_end_tests/golden-record/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ exclude = '''

[tool.isort]
line_length = 120
profile = "black"
profile = "black"
6 changes: 5 additions & 1 deletion openapi_python_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def __init__(
else:
loader = package_loader
self.env: Environment = Environment(
loader=loader, trim_blocks=True, lstrip_blocks=True, extensions=["jinja2.ext.loopcontrols"]
loader=loader,
trim_blocks=True,
lstrip_blocks=True,
extensions=["jinja2.ext.loopcontrols"],
keep_trailing_newline=True,
)

self.project_name: str = config.project_name_override or f"{utils.kebab_case(openapi.title).lower()}-client"
Expand Down