protobuf.js
protobuf.js copied to clipboard
add array of nested objects with guaranteed order
For proper deserialization of protobuf messages via the Confluent Schema Registry, we must have access to the messages in the order they appear in the schema so that we can select the target schema based on the message indices added during schema registry serialization. More info on the spec can be found here: https://docs.confluent.io/platform/current/schema-registry/fundamentals/serdes-develop/index.html#wire-format
This is part of a larger effort to fix a longstanding issue in the most widely used NodeJS Confluent Schema Registry client that does not follow the protobuf wire spec. I'll open a PR in that repo that implements the changes I've done here to properly encode/decode these messages.
I've added an additional array field to Namespaces/Types called orderedNestedObjects that achieves what I need here. I attempted to use the existing nestedArray/_nestedArray fields, but they were not populated when I need them (upon parsing a schema) and instead seemed to implement a more complicated caching mechanism while not guaranteeing the original ordering.
The implementation on this branch achieves my goals but may be missing something, it would be helpful if someone more familiar with the code could take a look + help me ensure my additions cleanly merge with the existing implementation. Happy to answer any questions / help iterate on this, thanks!
cc @alexander-fenster @bcoe
Hello, any updates on this?
@davidgrisham I am working on protobuf + schema registry implementation for confluent schema registry and found couple of your MRs to fix the issue with missing bytes for message-indexes. Any chance you found a workaround?
Thanks in advance