Open munic-mabs opened 6 months ago
Hi @munic-mabs
I don't want to blow off your idea, but I think globbing becomes complicated really fast. You can already see that in the questions you ask đŸ˜‰
Did you know type_attribute
can match on all messages in a package? Maybe you can reorganize the message to do a single match?
I think the best way to get this done in prost upstream is to work on it yourself. You might want to look at PathMap struct. This struct does the actual matching. Perhaps you could build a prototype so that we have a better idea of your solution.
Hi,
We'd like to have the ability to add an attribute to multiple types of the same nature. An example would be to derive a custom proc-macro for all of our
Response
types. Currently, it is done manually as follows.Ideally we'd be able to do something like this.
I am not aware of any pre-existing convention/implementation concerning the globbing of Protobuf paths. It'd be interesting to be able to also support more specific cases such as
.a.b.*.*Response
which would match.a.b.c.MyResponse
.Points that might be interesting to discuss.
What if two glob patterns, i.e., two
type_attribute
calls, match a given type. What would the expected behavior in this case? I believe that the current behavior oftype_attribute
preserves only one, possibly the last, entry?How can one exclude one or more types/attributes from a globbing pattern?
Is it possible to have a publicly accessible API to retrieve the result of glob expansion for debugging purposes?
While it seems more complex, an alternative implementation could offer the ability to inject custom logic to be executed for each message parsed by prost similarly to
ServiceGenerator
assuming it does not exist already.Thank you!