{"id":22772339,"url":"https://github.com/pactflow/example-bi-directional-provider-readyapi","last_synced_at":"2025-04-30T03:44:42.099Z","repository":{"id":105899501,"uuid":"514321308","full_name":"pactflow/example-bi-directional-provider-readyapi","owner":"pactflow","description":"Example provider using ReadyAPI tests generated from an OAS and PactFlow's bi-directional contracts feature","archived":false,"fork":false,"pushed_at":"2025-04-28T19:49:41.000Z","size":552,"stargazers_count":2,"open_issues_count":1,"forks_count":4,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-30T03:44:38.331Z","etag":null,"topics":["example"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pactflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2022-07-15T15:39:02.000Z","updated_at":"2025-04-28T19:49:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"c295b814-f3c6-4486-a18b-a6e1d031322f","html_url":"https://github.com/pactflow/example-bi-directional-provider-readyapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-bi-directional-provider-readyapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-bi-directional-provider-readyapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-bi-directional-provider-readyapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-bi-directional-provider-readyapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pactflow","download_url":"https://codeload.github.com/pactflow/example-bi-directional-provider-readyapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251638750,"owners_count":21619661,"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":["example"],"created_at":"2024-12-11T17:08:11.135Z","updated_at":"2025-04-30T03:44:42.079Z","avatar_url":"https://github.com/pactflow.png","language":"Makefile","readme":"# Example NodeJS Provider - ReadyAPI\n\n\u003c!-- Build Badge --\u003e\n\n[![Build Status](https://github.com/pactflow/example-bi-directional-provider-readyapi/actions/workflows/build.yml/badge.svg)](https://github.com/pactflow/example-bi-directional-provider-readyapi/actions)\n\n\u003c!-- Can I Deploy Badge --\u003e\n\n[![Can I deploy Status](https://testdemo.pactflow.io/pacticipants/pactflow-example-bi-directional-provider-readyapi/branches/main/latest-version/can-i-deploy/to-environment/production/badge)](https://testdemo.pactflow.io/pacticipants/pactflow-example-bi-directional-provider-readyapi/branches/master/latest-version/can-i-deploy/to-environment/production/badge)\n\n- [Example NodeJS Provider - ReadyAPI](#example-nodejs-provider---readyapi)\n  - [Overview of Example](#overview-of-example)\n    - [Key points](#key-points)\n  - [Overview of Part of Bi-Directional Contract Testing Flow](#overview-of-part-of-bi-directional-contract-testing-flow)\n  - [Compatibile with Consumers](#compatibile-with-consumers)\n  - [Pre-requisites](#pre-requisites)\n    - [Environment variables](#environment-variables)\n  - [Usage](#usage)\n    - [Steps](#steps)\n  - [OS/Platform specific considerations](#osplatform-specific-considerations)\n  - [Related topics / posts / discussions](#related-topics--posts--discussions)\n  - [Found an issue?](#found-an-issue)\n\n## Overview of Example\n\n\u003c!-- Provider Overview --\u003e\n\nThis is an example of a NodeJS \"Product\" API Provider that uses ReadyAPI, Pact, [PactFlow](https://pactflow.io) and GitHub Actions to generate and publish Pact provider contracts.\n\nIt performs pre-deployment cross-compatability checks to ensure that it is compatible with specified consumers using the Bi-Directional contract capability of PactFlow.\n\n\u003c!-- General --\u003e\n\nSee the full [PactFlow Bi-Directional Workshop](https://docs.pactflow.io/docs/workshops/bi-directional-contract-testing) for which this can be substituted in as the \"provider\".\n\n### Key points\n\nIt:\n\n- Is an API written in Express JS\n- Has a ReadyAPI Project (see `pf-swh-rapi-demo-readyapi-project.xml`) generated from an OpenAPI specification\n- Uses ReadyAPIs API testing capabilities to create test suites/cases from the OpenAPI specification\n- Uses ReadyAPIs dockerised test runner, to run the ReadyAPI testing suite in headless mode.\n  - For info see - https://support.smartbear.com/readyapi/docs/integrations/docker/soapui.html\n- Uploads the OpenAPI spec and ReadyAPI results to PactFlow\n\nWhat is uploaded to PactFlow is an OpenAPI specification that represents what you actually tested with ReadyAPI, to give us confidence it is compatible with a Pact consumer.\n\n## Overview of Part of Bi-Directional Contract Testing Flow\n\n\u003c!-- Provider Overview --\u003e\n\nIn the following diagram, you can see how the provider testing process works.\n\nWhen we call \"can-i-deploy\" the cross-contract validation process kicks off on PactFlow, to ensure any consumer consumes a valid subset of the OAS for the provider.\n\n![Provider Test](docs/provider-scope.png \"Provider Test\")\n\nThe project uses a Makefile to simulate a very simple build pipeline with two stages - test and deploy.\n\nWhen you run the CI pipeline (see below for doing this), the pipeline should perform the following activities (simplified):\n\n- Test\n  - Run tests to check provider codebase compliance with openAPI spec\n  - Publishes the openAPI specification and verification results, along with a version and branch name, to PactFlow.\n  - Check if we are safe to deploy to Production with `can-i-deploy` (ie. has the cross-contract validation has been successfully performed)\n- Deploy (only from \u003cmain|master\u003e)\n  - Deploy app to Production\n  - Record the Production deployment in the Pact Broker\n\n![Provider Pipeline](docs/provider-pipeline.png \"Provider Pipeline\")\n\n## Compatibile with Consumers\n\n\u003c!-- Consumer Compatability --\u003e\n\nThis project is currently compatible with the following consumers(s):\n\n- [pactflow-example-bi-directional-consumer-nock](https://github.com/pactflow/example-bi-directional-consumer-nock)\n- [pactflow-example-bi-directional-consumer-msw](https://github.com/pactflow/example-bi-directional-consumer-msw)\n- [pactflow-example-bi-directional-consumer-wiremock](https://github.com/pactflow/example-bi-directional-consumer-wiremock)\n- [pactflow-example-bi-directional-consumer-mountebank](https://github.com/pactflow/example-bi-directional-consumer-mountebank)\n\u003c!-- * [pactflow-example-bi-directional-consumer-dotnet](https://github.com/pactflow/example-bi-directional-consumer-dotnet) --\u003e\n\nSee [Environment variables](#environment-variables) on how to set these up\n\n## Pre-requisites\n\n**Software**:\n\n- Tools listed at: https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/prerequisites/\n- A pactflow.io account with an valid [API token](https://docs.pactflow.io/docs/getting-started/#configuring-your-api-token)\n- A ReadyAPI application downloaded to your machine\n  - A time-bound free trial license will suffice for a demo run locally on your machine\n  - _note_ - currently only tested on a Mac\n\n### Environment variables\n\nTo be able to run some of the commands locally, you will need to export the following environment variables into your shell:\n\n- `PACT_BROKER_TOKEN`: a valid [API token](https://docs.pactflow.io/docs/getting-started/#configuring-your-api-token) for PactFlow\n- `PACT_BROKER_BASE_URL`: a fully qualified domain name with protocol to your pact broker e.g. https://testdemo.pactflow.io\n\n## Usage\n\n### Steps\n\n- `make install` - install project dependencies\n\nRun each step separately\n\n- `make test_and_publish` - tests the provider and publishes provider contracts to PactFlow\n  - This will perform the following 2 calls\n    - `make test`\n    - `make publish_provider_contract`\n- `make can_i_deploy` - runs can-i-deploy to check if its safe to deploy the provider\n- `make deploy` - deploys the app and records deployment\n\nor run the whole lot in one go\n\n- `make ci` - run the CI process, but locally (uses Docker by default)\n\nInstalling alternate pact CLI tools.\n\nIf you don't have docker, you can use one of the ruby tools. The standalone, doesn't require that you install Ruby on your host machine.\n\n- `make install-pact-ruby-cli` - installs the pact ruby CLI tool\n- `make install-pact-ruby-standalone` - installs the pact standalone CLI depending on your platform\n- `make uninstall-pact-ruby-standalone` - uninstalls the pact standalone CLI\n\nUsing alternate pact CLI tools.\n\n- `PACT_TOOL=docker make ci` - run the CI process, using the pact Docker CLI tool\n- `PACT_TOOL=ruby_standalone make ci` - run the CI process, using the pact standalone CLI tool\n- `PACT_TOOL=ruby_cli make ci` - run the CI process, using the pact ruby CLI tool\n\n## OS/Platform specific considerations\n\nThe makefile has been configured to run on Unix/Windows and MacOS based systems, and tested against Github Actions\n\nThey can be run locally on Unix/Windows and MacOS, or on Windows via [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install) or a shell with bash.\n\n## Related topics / posts / discussions\n\n- [Consumer Side Bi-Directional Contract Testing Guide](https://docs.pactflow.io/docs/bi-directional-contract-testing/consumer)\n- [Provider Side Bi-Directional Contract Testing Guide](https://docs.pactflow.io/docs/bi-directional-contract-testing/provider)\n\n## Found an issue?\n\nReach out via a GitHub Issue, or reach us over in the [Pact foundation Slack](https://slack.pact.io)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-bi-directional-provider-readyapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpactflow%2Fexample-bi-directional-provider-readyapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-bi-directional-provider-readyapi/lists"}