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

Proto spec is to serialize int64 to String #4

Open
gorzell opened this issue Dec 20, 2021 · 2 comments
Open

Proto spec is to serialize int64 to String #4

gorzell opened this issue Dec 20, 2021 · 2 comments

Comments

@gorzell
Copy link
Contributor

gorzell commented Dec 20, 2021

The protocol buffer JSON spec seems to serialize int64 values to JSON strings, rather than numbers. It seems that serde/prost expect a number though, so if your proto includes an int64 the de-serialization will fail.

Error("invalid type: string \"5000\", expected i64", line: 1, column: 200)'

I am not familiar enough with serde/prost to know where the problem lies, but maybe you have some ideas?

I may be running into more of these edge cases be cause the JSON is being serialized by Go code and then I am trying to deserialize in Rust.

@gorzell
Copy link
Contributor Author

gorzell commented Dec 20, 2021

Interestingly, depending on which Go serializer you use this isn't consistent 😞.

@fdeantoni
Copy link
Owner

Interesting! Do you have a sample proto message with a code snippet that recreates this behaviour? Better yet if it could be a test case we can add to the test suite....

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

2 participants