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).
Note: The mock server crates have moved to https://github.com/pact-foundation/pact-core-mock-server.
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 pact_consumer
crate.
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.
Moved to https://github.com/pact-foundation/pact-core-mock-server.
Moved to https://github.com/pact-foundation/pact-core-mock-server.
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. Requires Rust 1.71.0 or later.
The build tool used is cargo
.
cd rust
cargo build
This will compile all the libraries and put the generated files in rust/target/debug
.
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.
or
- Twitter: @pact_up
- Stack Overflow: stackoverflow.com/questions/tagged/pact
The code in this project is licensed under a MIT license. See LICENSE.