Comments (5)
See: https://github.com/dcodeIO/ProtoBuf.js/wiki/Reflection
Let me know if this is helpful and feel free to ask questions.
from protobuf.js.
Thanks for the quick response.
This works, but a simpler API would definitely help. For example, it's not clear from the documentation that you are supposed to use the resolvedType
property to get at a nested message's reflection, and it seems the only way to get to the actual Message class from its reflection is to use the undocumented built
property. Let me know if I'm missing something.
from protobuf.js.
Thank you for your suggestions. I've changed the API a bit to use more intuitive names. What was built
before now is clazz
in the context of messages and object
in the context of enums. It's also no longer inherited from Reflect.T. Regarding resolvedType
, i've added that together with clazz
and object
to the reflection docs. However, this could possibly break existing programs using ProtoBuf.js at the reflection level, so I've decided to make this v1.1.0.
Please review it again and let me know what you think!
https://github.com/dcodeIO/ProtoBuf.js/wiki/Reflection
from protobuf.js.
Thanks, this is exactly what I was looking for.
Another point worth mentioning is that Builder#lookup()
works differently from Builder#build()
without an argument. While the former returns a Namespace object, the latter returns a name->type map, which I think is more useful, since key lookup is faster than iteration over an array (which, if my understanding is correct, is what happens internally when you provide an argument to lookup
).
from protobuf.js.
Yes, it's not exactly the same but similar. The recommended way to work with still is Builder#build
, while Builder#lookup
should be used only if reflection is actually required.
In the process of parsing, building and en/decoding, which is all sequental (name lookups need to be done only once), the array structure of the internal types is more efficient.
from protobuf.js.
Related Issues (20)
- pbts produces incorrect typings for `message Object`
- Version `7.2.6` breaks build and throws an error `Error: ENOENT: no such file or directory, open ...` HOT 3
- Editions Suport
- Error: invalid wire type 6 at offset 297 is reported in the parsing field
- decode(new Uint8Array(data)) RangeError: index out of range: 97045 + 1 > 97045 HOT 1
- glob < 9 pulls in insecure depedendency, inflight HOT 1
- how to define protofile for [[1, 2, 3]]
- [Bug]Can not encode the embedded "oneof" keywords issue with sparkplugB schema
- Does it support running on quickjs?
- Prototype Pollution vulnerability HOT 6
- CustomError [ProtocolError]: missing required 'header'
- Support repeated options
- `pbts` does not generate comments for enum properties
- Descriptor binaries does not match the binaries generated using `protoc`
- Javascript enviroment, Json to protobuf text format
- C++ and JS compatability HOT 2
- npm exec `could not determine executable to run`
- Latest protobuf release not listed on CDNs HOT 10
- v6.11.4 still listed as vulnerable to CVE-2023-36665 HOT 1
- `pbts` generating syntax error on types when using multi-line `@typedef`s in static code HOT 1
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 protobuf.js.