-
Notifications
You must be signed in to change notification settings - Fork 235
Add PactNet.Extensions.Grpc package for grpc plugin support #548
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
base: master
Are you sure you want to change the base?
Conversation
c34af19
to
990939e
Compare
a827783
to
7cbeac4
Compare
d4644b3
to
079935c
Compare
Many thanks for the PR - I can see you've put a lot of work into this! I think a good path forward would be to create some kind of framework for plugins to be able to hook into existing PactNet internals without making those internals themselves public. A few examples of where the approach in this PR isn't desireable:
For those reasons and more, I'd prefer to see some kind of framework created, probably as part of To me, success would look like:
I think this is a great step to achieving that, and congratulations to you for this being the first time that we've been able to run plugins in PactNet. It's been a long time coming 😁 |
This enables creating a nicer API to expose publicly for use by plugin wrappers. See: pact-foundation#492
@adamrodger I rebased this PR on top of PR #551 and made appropriate changes here to demonstrate that this is possible now. With those changes we can now create the new The only changes in this PR that are not in PR #551 are in aba5d3d which only adds the new library and associated tests.
This was achieved in PR #551 for synchronous plugin interactions, I was thinking we could add asynchronous interactions in a separate PR.
I'll leave it up to you how you want to go about doing this but would be willing to chip in if you want to provide some guidance. |
I have read through issue #492 thoroughly and examined the source code and feel that I have a decent understanding of what's involved in adding plugin support, specifically for Grpc. I was able to take @YOU54F's example and create this PR to get some sample Grpc tests working.
I have extracted a
PactNet.Interop
package as @adamrodger suggested in Issue #492 . This was not a breaking change since all the classes in this namespace were internal,PactNet
now references this new package and none of the pre-existing interface methods have changed. Extracting this package made it possible to create bare-bones Grpc plugin tests and is effectively a very "raw" way of using any plugin. Perhaps a next step would be to wrap the bare-bones methods in a more fluent "raw" interface in a plugin package similar to implementations in other languages as @mefellows suggested.Based on above "raw" tests I was able to refactor and extract shared functionality to create a new
PactNet.Extensions.Grpc
library that provides a fluent interface similar to the interfaces for http / rest and asynchronous messaging interactions.An alternative approach here would be to just add
<InternalsVisibleTo Include="PactNet.Extensions.Grpc" />
to the PactNet.csproj file but this allows integration of other plugins in repos outside this one so it depends on whether you want to explicitly allow that or not.