pactflow / pact-protobuf-plugin

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

Add support for `fromProviderState` generator #69

Open mefellows opened 1 month ago

mefellows commented 1 month ago

Hello, I'm trying to implement gRPC/protobuf tests for my application and I'm wondering if the gRPC/protobuf plugin has something like the valueFromProviderState that the REST API has? this is in case I would like to inject something like entity ID of an entity created during the state setup into the gRPC call ... is there a possible workaround for this? (i.e. creating entities as part of the state setup and somehow planting their IDs magically into the request Pact makes) I'm using a SpringBoot + JUnit5 + PactJVM + Pact protobuf plugin 0.4.0 stack if that matters at all (edited)

Ron's response

It looks like it will work for basic Protobufs, but the gRPC mock server is missing the data from the provider states, so will not be able to inject the values.

Source conversation: https://pact-foundation.slack.com/archives/CEQBDD5U4/p1722289550348409

More generally, it would be good to understand/document how client libraries would need to change to support this feature (if at all). I believe the current implementation assumes a JSON response to the provider state callback, so I'm not sure how it would work on arbitrary content types.

github-actions[bot] commented 1 month ago

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-2288). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.