This matches an API already present in proto2
(const DescriptorPool* FileDescriptor::pool()).
However there is a slightly subtle implication here.
In proto2, the relationship between Descriptor and
MessageFactory is 1:many. You can create as many
DynamicMessageFactory instances as you want, and
each one will have its own independent DynamicMessage
prototype and computed layout for the same underlying
Descriptor. In practice the layouts will all be the same,
but one thing that could be distinct is that each can
have its own extension pool, which is a DescriptorPool
that will be searched for extensions when parsing.
In contrast, upb does not have a separate "message
factory" abstraction. That means that each upb_msgdef
has a single distinct layout, in other words a 1:1
correspondence between descriptor and layout. This means
that there is no way to create multiple message types
for the same descriptor that have distinct extension
pools. If you want a different set of extensions, you
must create a separate upb_symtab with a distinct set
of descriptors.
This change further entrenches that upb_filedef:upb_symtab
is a 1:1 relationship. A single upb_filedef cannot be a
member of multiple symbol tables. In practice this was
already true (there is no way to add a single filedef to
multiple symbol tables) but this change codifies this
1:1 relationship.
- A new PHP-specific upb amalgamation. It contains everything related to upb_msg, but leaves out all of the old handlers-related interfaces and encoders/decoders.
# Schema/Defs Changes
- Changed `upb_fielddef_msgsubdef()` and `upb_fielddef_enumsubdef()` to return `NULL` instead of assert-failing if the field is not a message or enum.
- Added `upb_msgdef_iswrapper()`, to test whether this is a wrapper well-known type.
# Decoder
- Decoder bugfix: when we parse a submessage inside a oneof, we need to clear out any previous data, so we don't misinterpret it as a pointer to an existing submessage.
# JSON Decoder
- Allowed well-known types at the top level to have their special processing.
- Fixed a bug that could occur when parsing nested empty lists/objects, eg `[[]]`.
- Made the "ignore unknown" option also be permissive about unknown enumerators by setting them to 0.
# JSON Encoder
- Allowed well-known types at the top level to have their special processing.
- Removed all spaces after `:` and `,` characters, to match the old encoder and pass goldenfile tests.
# Message / Reflection
- Changed `upb_msg_hasoneof()` -> `upb_msg_whichoneof()`. The new function returns the `upb_fielddef*` of whichever oneof is set.
- Implemented `upb_msg_clearfield()` and added/implemented `upb_msg_clear()`.
- Added `upb_msg_discardunknown()`. Part of me thinks this should go in a util library instead of core reflection since it is a recursive algorithm.
# Compiler
- Always emit descriptors as an array instead of as a string, to avoid exceeding maximum string lengths. If this becomes a speed issue later we can go back to two separate paths.
* Added support for proto3 optional to defs.
* Added proto3 optional support. Untested at the moment.
* Changes to support proto3 optional.
* Fixed real oneof count for messages with no fields.
* Fixed compile error and test.
* Added comment about why I'm commenting out the assert.
This makes both the C (.h) and C++ (.hpp) files read nicer
and keeps the core of upb C-only.
Existing users of the C++ wrappers will have to add manual
#includes of the .hpp files.
* WIP, first version of encoder.
* More progress on text encoder.
* A lot of progress on the text printer.
* Added textencode header file.
* Text encoder now passes conformance tests.
These aren't very stringent though, and more testing is needed.
* Print text into static buffer. Passes all conformance tests.
* Fixed kokoro errors.
* Fix for indent depth when printing map fields.
* Implement json decoding for Any message.
type url may not appear as the first value in json. As a result,
other data cannot be resolved before resolving type url. To solve that,
this change caches the start and end position of unparsed values and
resolve them in end_any_object when type url has been resolved.
* Handle Any in switch
* Update json parser size
* Fix comments
* Sync upstream
* Add dependency on upb_pb for upb_json
* Debug failed test
* Fix cmake
* Update test generated files
* Remove debug tests
* Fix json encoding for wrappers, ListValue, Struct and Value.
* Add well_known_type field in upb_msgdef to specify type of well known messages.
* Remove comma at end of enum definition.
* Group number wrappers
* Fix comments
* Refactoring to use is_wellknown_{msg/field}
Use this option to change the namespace of php generated classes.
Default is empty. When this option is empty, the package name will be
used for determining the namespace.
This option will be prepended to all php generated classes. The PHP
runtime needs to know this option to figure out the class name for
specific message.