Reading:
Pact Specification 4.0 + Plugin Support

Pact Specification 4.0 + Plugin Support

Matt Fellows
Updated

On Jan 20, 2022 version 4 of the Pact Specification was ratified. The Pact Specification is a document that governs the structure of the actual generated pact files to allow for interoperability between languages (consider, for example, a JavaScript consumer connecting to a Scala JVM-based provider), using versioning to indicate breaking changes between them.

Each language implementation of Pact needs to implement the rules of this specification, and advertise which version(s) are supported, corresponding closely to which features are available.

With the V4 spec, there were several major new features added:

  • Support for synchronous messages, enabling request/response use cases outside of HTTP, to accompany existing support for asynchronous messaging
  • Allows HTTP and non-HTTP (aka "Message Pact") interactions in a single pact file
  • Support for user defined plugins, to extend the behaviour of Pact

...among a number of other quality of life improvements and matchers.

PactFlow UI Support

It's imperative that PactFlow customers receive the highest level of support for their contract testing experience, and so today we're pleased to announce that V4 pacts - including rendering markdown associated with user-defined plugins - are now supported in several languages, and contracts generated from them can be properly displayed in the PactFlow UI.

Here is a gRPC example that shows a verified contract

Example plugin-based (V4) pact showing a gRPC contract test

Notice how at the top of the contract, we can see a user-defined view of the contract:

Whilst we actually support a reasonably reach subset of Markdown, in this case, it's just a rendered protobuf using the familiar ```language code gates syntax.

Available Now

Plugins interactions and any other pact files created using version 4 of the spec are now available on all plans.

arrow-up icon