{"id":15289152,"url":"https://github.com/itv/scala-pact","last_synced_at":"2025-04-06T02:11:26.526Z","repository":{"id":8817663,"uuid":"50524052","full_name":"ITV/scala-pact","owner":"ITV","description":"A Scala implementation of CDC using the Pact standard","archived":false,"fork":false,"pushed_at":"2024-08-28T17:14:57.000Z","size":2339,"stargazers_count":108,"open_issues_count":29,"forks_count":53,"subscribers_count":79,"default_branch":"main","last_synced_at":"2025-04-06T02:11:21.263Z","etag":null,"topics":["cdc","pact","scala","streaming-library","testing","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ITV.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-27T17:18:03.000Z","updated_at":"2025-01-21T18:31:05.000Z","dependencies_parsed_at":"2024-10-14T20:00:54.727Z","dependency_job_id":"327cb1f9-e50a-404f-9115-6773b3e5f21b","html_url":"https://github.com/ITV/scala-pact","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITV%2Fscala-pact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITV%2Fscala-pact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITV%2Fscala-pact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITV%2Fscala-pact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ITV","download_url":"https://codeload.github.com/ITV/scala-pact/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdc","pact","scala","streaming-library","testing","testing-tools"],"created_at":"2024-09-30T15:59:25.744Z","updated_at":"2025-04-06T02:11:26.501Z","avatar_url":"https://github.com/ITV.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scala-Pact [![Build Status](https://travis-ci.com/ITV/scala-pact.svg?branch=master)](https://travis-ci.com/ITV/scala-pact)\n\nA Consumer Driven Contract testing library for Scala and [ScalaTest](http://www.scalatest.org/) that follows the [Pact](https://docs.pact.io/) standard.\n\nScala-Pact is intended for Scala developers who are looking for a better way to manage the HTTP contracts between their services.\n\nIf you are just starting out on your pact journey in scala, we recommend checking out [pact4s](https://github.com/jbwheatley/pact4s). This is built directly on top of pact-jvm, and provides support for writing and verifying contracts using [scalaTest](https://github.com/scalatest/scalatest), [weaver-test](https://github.com/disneystreaming/weaver-test), and [munit-cats-effect-3](https://github.com/typelevel/munit-cats-effect). \n\n## Latest version is 4.4.0\n\nScala-Pact currently only supports [v2 of the pact specification](https://github.com/pact-foundation/pact-specification/tree/version-2). To use pacts with v3+ of the pact specification, use `pact4s` instead. This project will not support versions beyond v2. \n\nScala-Pact now has two branches based on SBT requirements. \n\n#### SBT 1.x compatible (Latest 4.4.0)\n\nAll development going forward begins at `2.3.x` and resides on the `master` branch.\nFor the sake of the maintainer's sanity, version 2.3.x and beyond will only support Scala 2.12 and SBT 1.x or greater. The project is currently cross-compiled across scala 2.12.12 and 2.13.4. \n\n#### SBT 0.13.x compatible (Latest 2.2.5)\n\nThe reluctantly maintained EOL maintenance version of Scala-Pact lives on a branch called `v2.2.x`.\nThese versions support Scala 2.10, 2.11, and 2.12 but are limited by only supporting SBT 0.13.x.\n\n## More information\n\nPlease visit our [official documentation site](http://io.itv.com/scala-pact/) for more details and examples.\n\nThere is also an [example project](http://io.itv.com/scala-pact/examples/index.html) setup for reference.\n\n## Getting setup\n\nScala-Pact goes to great lengths to help you avoid / work around dependency conflicts. \nThis is achieved by splitting the core functionality out of the library requirements which are provided separately. This allows you to align or avoid conflicting dependencies e.g. If your project uses a specific version of Circe, tell Scala-Pact to use Argonaut!\nOne big change between 2.2.x and 2.3.x is that dependencies are now provided by TypeClass rather than just static linking. Please refer to the [example setup](https://github.com/ITV/scala-pact/tree/master/example).\n\n### You're using SBT 1.x:\n\nThere are two approaches to using the scala-pact dsl. The new approach uses a single dependency and mix-ins to use the dsl. The old approach allows more freedom in which http and json library versions are being used, but requires more dependencies and imports. \n\n#### Mix-ins approach \n\nAdd the following lines to your `build.sbt` file to setup the test framework:\n```scala\n\nimport com.itv.scalapact.plugin._\n\nenablePlugins(ScalaPactPlugin)\n        \nlibraryDependencies ++= Seq(\n  \"com.itv\"       %% \"scalapact-scalatest-suite\"   % \"4.4.0\" % \"test\",\n  \"org.scalatest\" %% \"scalatest\"                   % \"3.2.9\"  % \"test\"\n)\n```\n\nAdd this line to your `project/plugins.sbt` file to install the plugin:\n```scala\naddSbtPlugin(\"com.itv\" % \"sbt-scalapact\" % \"4.4.0\")\n```\n\nBoth the import and the plugin come pre-packaged with the latest JSON and Http libraries (http4s 0.21.x, and circe 0.13.x). \n\nIn your consumer test suites, have the test class extend `PactForgerSuite`. In your provider test suites, have the test class extend `PactVerifySuite`. \n\n#### Without mix-ins\nIf your project needs more control over the dependencies used by scala-pact, add the following lines to your `build.sbt` file to setup the test framework:\n```scala\n\nimport com.itv.scalapact.plugin._\n\nenablePlugins(ScalaPactPlugin)\n        \nlibraryDependencies ++= Seq(\n  \"com.itv\"       %% \"scalapact-circe-0-13\"   % \"4.4.0\" % \"test\",\n  \"com.itv\"       %% \"scalapact-http4s-0-21\"  % \"4.4.0\" % \"test\",\n  \"com.itv\"       %% \"scalapact-scalatest\"    % \"4.4.0\" % \"test\",\n  \"org.scalatest\" %% \"scalatest\"              % \"3.2.9\" % \"test\"\n)\n```\n\nAdd this line to your `project/plugins.sbt` file to install the plugin:\n```scala\naddSbtPlugin(\"com.itv\" % \"sbt-scalapact\" % \"4.4.0\")\n```\nThis version of the plugin comes pre-packaged with the latest JSON and Http libraries.\nThanks to the way SBT works, that one plugin line will work in most cases, but if you're still having conflicts, you can also do this to use your preferred libraries:\n\n```scala\n libraryDependencies ++= Seq(\n   \"com.itv\" %% \"scalapact-argonaut-6-2\" % \"4.4.0\",\n   \"com.itv\" %% \"scalapact-http4s-0-21\"  % \"4.4.0\"\n )\n \n addSbtPlugin(\"com.itv\" % \"sbt-scalapact-nodeps\" % \"4.4.0\")\n```\n\nIn your test suite, you will need the following imports:\n\nThe DSL/builder import for Consumer tests:\n```scala\n  import com.itv.scalapact.ScalaPactForger._\n```\nOr this one for Verification tests:\n```scala\n  import com.itv.scalapact.ScalaPactVerify._\n``` \nYou'll also need to reference the json and http libraries specified in the `build.sbt` file:\n```scala\n  import com.itv.scalapact.circe09._\n  import com.itv.scalapact.http4s18._\n```\nAlternatively, in case your project has both `scalapact-http4s` and `scalapact-circe` as dependencies, you could also use the following:\n\n```scala\n  import com.itv.scalapact.json._\n  import com.itv.scalapact.http._\n```\n\n### You're using SBT 0.13.x:\n\nAdd the following lines to your `build.sbt` file to setup the test framework:\n```scala\n\nimport com.itv.scalapact.plugin._\n\nenablePlugins(ScalaPactPlugin)\n        \nlibraryDependencies ++= Seq(\n  \"com.itv\"       %% \"scalapact-circe-0-9\"     % \"2.2.5\" % \"test\",\n  \"com.itv\"       %% \"scalapact-http4s-0-18-0\" % \"2.2.5\" % \"test\",\n  \"com.itv\"       %% \"scalapact-scalatest\"     % \"2.2.5\" % \"test\",\n  \"org.scalatest\" %% \"scalatest\"               % \"3.0.5\" % \"test\"\n)\n```\n\nAdd these lines to your `project/plugins.sbt` file to install the plugin:\n```scala\nlibraryDependencies ++= Seq(\n  \"com.itv\" %% \"scalapact-argonaut-6-2\"  % \"2.2.5\",\n  \"com.itv\" %% \"scalapact-http4s-0-16-2\" % \"2.2.5\"\n)\n\naddSbtPlugin(\"com.itv\" % \"sbt-scalapact\" % \"2.2.5\")\n```\nIn you're test suite, you will need the following import for Consumer tests:\n```scala\n  import com.itv.scalapact.ScalaPactForger._\n```\nOr this one for Verification tests:\n```scala\n  import com.itv.scalapact.ScalaPactVerify._\n``` \n\nNote that you can use different versions of Scala-Pact with the plugin and the testing framework, which can make Scala 2.10 compat issues easier to work around while we get the SBT 1.0 release sorted out.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitv%2Fscala-pact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitv%2Fscala-pact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitv%2Fscala-pact/lists"}