Pact implementation written in Rust.
This project provides a Pact implementation written in Rust. It supports the V3 Pact specification and V4 Pact specification and provides shared libraries that can be used in other languages via foreign function interfaces (FFI).
Installing / Getting started
The project crates are published to crates.io, and you can use them directly.
For a Rust consumer, refer to the pact_consumer crate.
You can find examples where the integration to the Pact Broker is tested using
Pact tests written with the
To verify a provider, you can use the verifier CLI tool. See Pact Verifier CLI.
Other languages can use the core features through FFI shared libraries. These libraries expose functions that follow a C calling convention.
For example for a project using Conan and CMake that links to the
pact-ffi crate, see Pact-C++.
TODO after merging FFI libs
There are 8 main crates to this implementation:
This is a library that provides the Pact models and functions for reading and writing pact files.
This is a library that provides the Pact functions for matching requests and responses.
This is a library that implements exported functions using C bindings for use in foreign languages.
This is a library that provides an in-process mock server for Pact client tests. It uses the pact_matching library.
This module provides a command line executable that provides a standalone pact mock server and commands for controlling the mock servers. It uses the libpact_mock_server and libpact_matching libraries.
This is a library that provides the Pact consumer test support and DSL for use in Rust projects.
This library provides support for verifying a provider against pact files.
Command line excutable that uses the pact_verifier to be able to verify a running provider against pact files.
To build the libraries in this project, you need a working Rust environment. Refer to the Rust Guide.
The build tool used is
This will compile all the libraries and put the generated files in
The released libraries for each module are built by a GH action that attaches the libraries to the GH release for each
crate. To release a crate, run the
release.groovy script in the crate directory. This will guide you through the
release process for the crate. Then create a GH release using the tag and changelog created by the script.
See CONTRIBUTING (PRs are always welcome!).
Rust crate documentation is published to the Rust documentation site.
Additional documentation can be found at the main Pact website.
- Twitter: @pact_up
- Stack Overflow: stackoverflow.com/questions/tagged/pact
The code in this project is licensed under a MIT license. See LICENSE.