Skip to content

Commit fb3fd32

Browse files
Modify export_schema cli to include an extra EOF newline when --output option is provided (#3896)
* Modify export_schema cli to include an extra EOF newline when --output option is provided. * Update strawberry/cli/commands/export_schema.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 1cba4f5 commit fb3fd32

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

RELEASE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Release type: patch
2+
3+
This release modifies export-schema cli to include an EOF newline if --output option is provided. This allows better review in github.com for the generated schema files.

strawberry/cli/commands/export_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def export_schema(
3232
schema_text = print_schema(schema_symbol)
3333

3434
if output:
35-
Path(output).write_text(schema_text)
35+
Path(output).write_text(schema_text + "\n", encoding="utf-8")
3636
typer.echo(f"Schema exported to {output}")
3737
else:
3838
print(schema_text) # noqa: T201

tests/cli/test_export_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ def test_output_option(cli_app: Typer, cli_runner: CliRunner, tmp_path):
9494
"type User {\n"
9595
" name: String!\n"
9696
" age: Int!\n"
97-
"}"
97+
"}\n"
9898
)

0 commit comments

Comments
 (0)