jackson-dataformats-binary
jackson-dataformats-binary copied to clipboard
[protobuf] support import statement
proto files often import other proto files using the import
statement. As far as I tested, the import statement is not supported.
I think NativeProtobufSchema
class is the best place to load/cache the external proto dependecy, and resolve message types if they are not found in the _nativeTypes
.
Do you think it's a sane idea?
Importing is a big challenge: it is important for larger schemas, but is tricky to handle and perhaps potential security concern (at least in XML world ability to reference to DTD content via entities has caused problems -- not exactly identical, but often allows access to files that couldn't accessed otherwise). This may or may not be a big problem since calling code still needs to request reading of schema, and this is not done automatically for content... but something to consider.
So I think that yes, allowing imports would be good, but probably needs to be configurable, to allow pluggable resolution. This could be used to implement caching, but without requiring this module to provide it.