Comments (1)
@sduchesneau, I'm afraid I can't accept such a patch, for a couple of reasons:
-
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.
-
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)
- panic: invalid type: got *dynamicpb.Message when GetExtension HOT 6
- can not FindMessage from linked files HOT 2
- Breaking changes in the protocompile/ast dependency
- EnumBuilder panics if it contains EnumValue with explicitly set Number HOT 1
- might not be bug: false duplication report due to use of relative path instead of absolute path HOT 6
- SIGSEGV: panic: runtime error: invalid memory address or nil pointer dereference in v1.15.2 HOT 8
- Protoreflect doesn't fall back to to v1alpha when a gRPC unimplemented response is returned HOT 1
- String escaping in protoprint is wrong HOT 1
- First enum value must be 0 in proto3 [protoprint] HOT 2
- missing `{}` after printing option HOT 5
- Upgrade protocompile to v0.7.0 HOT 3
- go build error HOT 3
- Regression upgrading from v1.14.1 to v1.15.4: extensions are resolved recursively instead of non-recursively HOT 1
- Regression upgrading from v1.14.1 to v1.15.4: absolute paths no longer accepted by parser.ParseFilesButDoNotLink HOT 3
- Regression upgrading from v1.14.1 to v1.15.4: new mustBeSource constraint/check HOT 5
- Stub structure and Methods will relay on protobuf API V2 HOT 13
- Fail to compile proto file HOT 2
- Tests broken with google.golang.org/protobuf v1.33.0
- If there are messages nested in the proto file, the numbers will be recognised as strings HOT 2
- invalid memory address or nil pointer dereference HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protoreflect.