Skip to content

RFC: Pact Plugins #492

Open
Open
@adamrodger

Description

@adamrodger

Is your feature request related to a problem? Please describe.
The Pact ecosystem now supports plugins, and PactNet should be part of this. See https://docs.pact.io/plugins/quick_start

Describe the solution you'd like
The implementation details are entirely TBD currently, but some thoughts:

  • It is not desirable to add more and more dependencies to PactNet and make the library bigger and bigger. Instead the plugins should be separate projects, e.g. in a PactNet.Extensions.* namespace format.
  • Plugins rely on FFI calls, which means that they need to load the FFI library and it has to be the same instance and version that the rest of the process has loaded so that it writes to the same Pact file in the same way etc.
    • It was originally envisaged that plugins could add extensions methods to add appropriate functionality (e.g. a WithProtobufContent to mirror the existing WithJsonContent calls) but the FFI aspect probably makes this pretty awkward
    • One solution may be to refactor the FFI interop parts out of PactNet and into a dedicated PactNet.Interop (or similar name) so that any plugin projects could depend on this and on PactNet.Abstractions to add functionality in a non-breaking way. This refactor would be a breaking change upfront though so this idea would need to be properly thought out.
  • Plugins are installed to the OS, which creates friction in PactNet itself because you would install e.g. PactNet.Extensions.Protobuf but that doesn't actually install the plugin, just the API support in PactNet. This can be confusing for users.

Breaking Changes
Depending on the implementation details above (TBD at the time of writing) this may involve breaking changes.

Potential Downsides/Caveats

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIndicates new feature requests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions