-
Notifications
You must be signed in to change notification settings - Fork 466
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
Fix required property serialization #98
Comments
The Java and C++ have some pretty good smarts in the generators to make the code as minimal as possible. We might even be able to just make the default return The serialization apis can also be done in terms of a generated partial api, so the basic impl checks valid before/after calling the partial api. |
This could affect the API between the generated code and the library, so I've labelled it accordingly. I'd like to resolve all remaining such issues fairly soon. |
The C++ generator code for an optimized |
- Add isInitialized Message protocol - Provide default isInitialized so the generator can emit a custom one as needed. - Add isInitialized to ExtensionFields so Message can call to it. - Add Internal.swift as a place to hold public code (because the generated code has to be able to call it), but that is not intended to be part of the "developer public" api. - Helpers for checking a map and repeated field for being initialized. - Generate isInitialized - Walk the message fields to decided if directly/indirectly can have messages with required fields. Re apple#98
- Add isInitialized Message protocol - Provide default isInitialized so the generator can emit a custom one as needed. - Add isInitialized to ExtensionFields so Message can call to it. - Add Internal.swift as a place to hold public code (because the generated code has to be able to call it), but that is not intended to be part of the "developer public" api. - Helpers for checking a map and repeated field for being initialized. - Generate isInitialized - Walk the message fields to decided if directly/indirectly can have messages with required fields. Re apple#98
Once the |
- Add isInitialized Message protocol - Provide default isInitialized so the generator can emit a custom one as needed. - Add isInitialized to ExtensionFields so Message can call to it. - Add Internal.swift as a place to hold public code (because the generated code has to be able to call it), but that is not intended to be part of the "developer public" api. - Helpers for checking a map and repeated field for being initialized. - Generate isInitialized - Walk the message fields to decided if directly/indirectly can have messages with required fields. Re apple#98
Now that the renaming is done, I'll look at adding the initialization checks into the binary serialization apis. |
FYI: I'm about to put up a big PR with a performance overhaul of the encoding side. (To match the work I did last week on the decoding side.) |
Add partial support to the binary decoding initializer. Progress on #98
PRs in, this should be complete. PR #307 adds a merge method and it ended up being useful to clean up some tests. |
…s-android fix for crash on notifications when device gets disconnected
For proto2, we need to support two kinds of serialization/parsing:
The typical pattern is to implement full in terms of partial. Implement an
isInitialized
method/property. For full writing, call it to validate before calling the partial write method (C++ example). For reading, do the partial read and then call it to validate (C++ example).proto3 doesn't need to distinguish between partial and full, AFAIK, but we may want keep both to avoid surfacing different APIs (since much of this can be implemented in protocol extensions). For proto3,
isInitialized
could vacuously return true.The text was updated successfully, but these errors were encountered: