#pact #cdc #testing

pact_models

Pact-Rust support library that provides the core models for dealing with Pact files

84 releases (47 stable)

Uses new Rust 2024

new 1.3.8 Feb 18, 2026
1.3.7 Sep 16, 2025
1.3.6 Jul 29, 2025
1.3.0 Mar 25, 2025
0.1.0 Jul 23, 2021

#662 in Parser implementations

Download history 2444/week @ 2025-10-29 1884/week @ 2025-11-05 1443/week @ 2025-11-12 1705/week @ 2025-11-19 1548/week @ 2025-11-26 969/week @ 2025-12-03 1223/week @ 2025-12-10 1408/week @ 2025-12-17 337/week @ 2025-12-24 495/week @ 2025-12-31 869/week @ 2026-01-07 1295/week @ 2026-01-14 1529/week @ 2026-01-21 1304/week @ 2026-01-28 1911/week @ 2026-02-04 1266/week @ 2026-02-11

6,304 downloads per month
Used in 18 crates (15 directly)

MIT license

1MB
24K SLoC

The pact_models crate provides all the structs and traits required to model a Pact.

Crate features

All features are enabled by default

  • datetime: Enables support of date and time expressions and generators. This will add the chronos crate as a dependency.
  • xml: Enables support for parsing XML documents. This feature will add the sxd-document crate as a dependency.

Pact Models

This library provides the core models for dealing with Pact files. It supports the V3 pact specification and V4 pact specification.

Online rust docs

Reading and writing Pact files

The Pact struct has methods to read and write pact JSON files. It supports all the specification versions up to V4, but will convert a V1, V1.1 and V2 spec file to a V3 format.

Crate features

All features are enabled by default

  • datetime: Enables support of date and time expressions and generators. This will add the chronos crate as a dependency.
  • xml: Enables support for parsing XML documents. This feature will add the sxd-document crate as a dependency.

Dependencies

~12–33MB
~349K SLoC