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

metadata API: serialization is missing a final newline #2393

Open
jku opened this issue May 16, 2023 · 0 comments
Open

metadata API: serialization is missing a final newline #2393

jku opened this issue May 16, 2023 · 0 comments

Comments

@jku
Copy link
Member

jku commented May 16, 2023

Our JSON serialization is basically json.dumps(metadata_obj.to_dict(), ...).encode("utf-8")

json.dumps() return value does not end in a newline. This means any files written with this content will not end in a newline: this makes the produced files not valid posix text files.

For Metadata.to_file() this seems like a minor bug (and Metadata.to_bytes() should have the same output for consistency), so in practice JSONSerializer.serialize() probably should add the final newline.

My only concern about this is that it is an unexpected change in the serialization output... IF we change this, we should definitely consider this an API change for users who produce metadata.

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

No branches or pull requests

1 participant