Skip to content
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

Add a trailing newline to OpenAPI spec output #988

Merged
merged 2 commits into from
May 15, 2024

Conversation

jgallagher
Copy link
Contributor

Fixes a papercut - if one opens an OpenAPI spec JSON file in an editor that wants to save files with trailing newlines, that breaks later expectorate tests. This changes the output to include a trailing newline instead.

@jgallagher jgallagher requested review from davepacheco and ahl May 3, 2024 19:10
@ahl
Copy link
Collaborator

ahl commented May 3, 2024

I don't know if this makes me dumb or a genius, but my editor strips out the trailing newline in json documents. I'm sure I could configure it to preserve them... but it does seem that this may be an annoyance in either direction.

@jclulow
Copy link
Collaborator

jclulow commented May 4, 2024

In general I believe most tools expect a UNIX text file to be either totally empty (0 bytes) or a whole number of lines, each terminated by a linefeed. What text editor is removing them?!

@ahl
Copy link
Collaborator

ahl commented May 4, 2024

Vim

@sunshowers
Copy link
Contributor

sunshowers commented May 4, 2024

I think the general expectation is as @jclulow said, to always have a trailing newline yeah. Hence e.g. git shows the "No newline at end of file" message.

@ahl
Copy link
Collaborator

ahl commented May 4, 2024

I see: "an industry standard best practice"!

@jgallagher
Copy link
Contributor Author

I got something I'm interpreting as permission-to-merge from Adam offline.

@jgallagher jgallagher merged commit 0f70a10 into main May 15, 2024
11 checks passed
@jgallagher jgallagher deleted the openapi-trailing-newline branch May 15, 2024 16:59
@ahl
Copy link
Collaborator

ahl commented May 15, 2024

I got something I'm interpreting as permission-to-merge from Adam offline.

I think my exact words were "over my dead body"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants