Code Monkey home page Code Monkey logo

Comments (1)

jhump avatar jhump commented on June 10, 2024

@sduchesneau, I'm afraid I can't accept such a patch, for a couple of reasons:

  1. The JSON format for Protobuf has a spec. So doing things outside the spec will lead to interop problems and is not really a good idea. That link is not as thorough as the conformance tests, which include tests for the JSON format and indicate expected behavior for all kinds of corner cases.

    Full disclosure: I've not run the conformance tests against this implementation; I'm sure there are some edge cases where my implementation is incorrect. But I've tried to implement this per the spec, and adding an option for a format that cannot interop with any other implementation doesn't seem valuable to me. Sorry.

  2. Per the note at the top of this repo's main README, v1.15.1 is the last expected v1 version of this repo. And a v2 of this repo will not have a dynamic package. That's because the v2 API of the Protobuf Go runtime (released a few years after I wrote this stuff) now includes its own version of that functionality: google.golang.org/protobuf/types/dynamicpb.

So I would recommend using that dynamicpb package linked above for dynamic messaging, instead of the dynamic package in this repo.

If you really need a custom JSON format, I would implement it in a separate package. Marshalling should be pretty straight-forward to implement on top of the Protobuf Go runtime's protoreflect features. Unmarshaling is always harder than marshalling, though the Go standard library includes a decent decoder library. If you were to fork existing code to implement this, you might consider forking the implementation in protojson instead of the implementation here.

from protoreflect.

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.