pactflow / pact-protobuf-plugin

Pact plugin for Protobufs and gRPC
MIT License
16 stars 8 forks source link

Support metadata with message pacts #43

Open stan-is-hate opened 5 months ago

stan-is-hate commented 5 months ago

This plugin currently supports grpc request/response metadata when doing grpc services. It would be great if it also supported metadata with the proto messages too.

Our particular use-cases is around kafka messages, where apart from the message body we can also have message key, headers, and topic data (name, replication factor). Each of these is encoded in bytes: https://github.com/confluentinc/confluent-kafka-go/blob/master/kafka/message.go#L72 We often encode body as a proto as well.

So for cases when body is a proto, I was thinking of using this plugin and use the proto message to pass the body and metadata to pass the rest of the fields (key, headers).

However I don't think metadata is supported when passing proto messages (last parameter is None): https://github.com/pactflow/pact-protobuf-plugin/blob/main/src/protobuf.rs#L301

stan-is-hate commented 5 months ago

I'm willing to help, but don't know rust. Will learn it eventually, but will likely take some time since I'm working on other projects too rn :)