add array of nested objects with guaranteed order #1957
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 existingnestedArray
/_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