-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enable unknown fields for descriptor protos #479
Conversation
# [1.102.0](v1.101.0...v1.102.0) (2022-01-18) ### Features * enable unknown fields for descriptor protos ([#479](#479)) ([824c996](824c996))
🎉 This PR is included in version 1.102.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@Vilsol looks great! The Fwiw I might have pinned ts-proto-descriptors to ts-proto that had optional-field behavior that worked with protobuf v2's Like at one point (which is probably still true today), how ts-proto handled optional fields meant that (with the ts-proto-descriptors generated by that version of ts-proto) we couldn't tell the difference between I think it was this commit: ...more context in this issue #218 ...and then it goes back to this one #139 which is basically highlighting that ts-proto does not have the So...you can try bumping ts-proto-descriptors to 1.4.0 and see what happens, but after re-remembering things, I'm 90% sure you're going to hit this limitation. :-/ Wdyt? Any good ideas? |
@stephenh It looks like indeed that causes a lot of issues. One alternative we could have is provide yet another metadata field behind some option flag like All it would do is add the field name to a list (or set) when it was decoded. So this: case 9:
message.oneofIndex = reader.int32();
break; would become case 9:
message._definedFields[tag] = __spread((message._definedFields[tag] || []), ['oneofIndex']);
message.oneofIndex = reader.int32();
break; I see how this is an ugly solution, but I can't think of any other that wouldn't also impact other users of the generator. |
@Vilsol yeah... I guess if we have to go the flag route (which I think we do...) we could add a flag that opts into the I.e. it put the defaults into a prototype, so the Personally I really like that behavior, it just sucks that But, complaining about The upshot would also be that then anyone else who really needs Wdyt? Do you want to try and resurrect that old PR? I can as well, disclaimer not sure when I'd get to it... |
@stephenh Seems like that is the only way out of this. When you say PR, I assume you meant the issue #139 ? Either way, I can try implementing such a flag, seems like it would just be the 2 changes to |
Builds upon #473 to add support for options in #437.
I had to also enable
--downlevelIteration
tsc flag as that is now a requirement due to looping overUint8Array
.The tests will most likely need to be updated after the package is published.