Giter VIP home page Giter VIP logo

Comments (3)

neoeinstein avatar neoeinstein commented on August 22, 2024 1

This is neither an issue with the plugin, nor the upstream pbjson dependency. The Protobuf specification includes a specification for the canonical JSON form for a given Protobuf schema. In that specification, it requires that 64-bit integers be serialized as strings.

The underlying reason for this is that in JavaScript, and many parsers of JSON, all numbers are 64-bit floating points. A 64-bit floating point cannot precisely store any integer larger than 53 bits. Thus, a 64-bit integer of a certain size cannot be guaranteed to be interpreted correctly if written and read as a number. A string allows for the exact representation of that value, to be interpreted as necessary in a target deserializer.

Per that same specification, the reader for both 32-bit and 64-bit integers will accept both strings and raw numbers.

from protoc-gen-prost.

LuisOsta avatar LuisOsta commented on August 22, 2024

@neoeinstein Do you know if this is an issue with this plugin or with an upstream dependency like Prost?

from protoc-gen-prost.

LuisOsta avatar LuisOsta commented on August 22, 2024

@neoeinstein So what would you recommend if we are trying to use serde to serialize to some other format that's not JSON? The reason for confusion is that at face value looking at the serialize function it seemed to have been generic, I wasn't aware that it was JSON-specific

from protoc-gen-prost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.