-
Notifications
You must be signed in to change notification settings - Fork 23
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
Programmatically build descriptors #32
Comments
What do you imagine the API would look like? Would it be an alternative constructor for something like |
In my specific case, I need something like this: let some_other_msg_desc = {}; // This comes from user descriptors
let other_message_field = some_other_msg_desc.get_field(1).unwrap();
let msg_desc = MessageDescriptor::builder("package.Name")
.with_field(other_message_field)
.build(); Perhaps I need to manipulate let manipulated_message_field = FieldDescriptor::builder_from(other_message_field)
.set_name("my_new_field")
.set_number(1)
.build(); Once I have this new I guess to be able to work with Does this makes somewhat sense? |
Thanks, that does make sense! The current API is very much based around using FileDescriptorProtos from the protobuf compiler - but maybe a builder API could be implemented as a more convenient wrapper around adding a dummy FileDescriptorProto and DescriptorProto to the pool. |
Build a dummy However, |
The clone should be pretty fast, since its just cloning an I've considered adding a reference based set of descriptor types in #7 but its a pretty big API change and I haven't run into any performance bottlenecks yet. I'm interested to know if its an issue in your case though! |
One issue with building descriptors manually is that extra validation checks in future may cause the |
Hi,
I wonder whether it might be possible to programmatically build descriptors in code. I have a use case where I get user descriptors and I modify them, based on an extension value.
The text was updated successfully, but these errors were encountered: