{"id":15524535,"url":"https://github.com/sergeyklay/provider-pact-example","last_synced_at":"2025-04-23T07:31:53.249Z","repository":{"id":65685112,"uuid":"592216369","full_name":"sergeyklay/provider-pact-example","owner":"sergeyklay","description":"Provider-side demo using consumer-driven contract testing","archived":false,"fork":false,"pushed_at":"2025-04-20T06:16:43.000Z","size":1453,"stargazers_count":5,"open_issues_count":11,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T07:23:13.952Z","etag":null,"topics":["api","api-project","api-server","api-service-for-crud","api-specification","api-testing","consumer-driven-contracts","contract-driven-development","contract-testing","contract-tests","contracts","flask-api","flask-application","flask-example","openapi","openapi3","pact","pact-provider"],"latest_commit_sha":null,"homepage":"","language":"Python","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/sergeyklay.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.rst","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-23T08:22:09.000Z","updated_at":"2025-04-20T06:15:36.000Z","dependencies_parsed_at":"2023-02-18T15:15:32.330Z","dependency_job_id":"0d035386-5884-4f33-a3c2-fb1c59b451c8","html_url":"https://github.com/sergeyklay/provider-pact-example","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeyklay%2Fprovider-pact-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeyklay%2Fprovider-pact-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeyklay%2Fprovider-pact-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeyklay%2Fprovider-pact-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergeyklay","download_url":"https://codeload.github.com/sergeyklay/provider-pact-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250391475,"owners_count":21422905,"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":["api","api-project","api-server","api-service-for-crud","api-specification","api-testing","consumer-driven-contracts","contract-driven-development","contract-testing","contract-tests","contracts","flask-api","flask-application","flask-example","openapi","openapi3","pact","pact-provider"],"created_at":"2024-10-02T10:51:37.788Z","updated_at":"2025-04-23T07:31:53.214Z","avatar_url":"https://github.com/sergeyklay.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. raw:: html\n\n    \u003ch1 align=\"center\"\u003eProvider API Example\u003c/h1\u003e\n    \u003cp align=\"center\"\u003e\n        \u003ca href=\"https://github.com/sergeyklay/provider-pact-example/actions/workflows/test-contracts.yaml\"\u003e\n            \u003cimg src=\"https://github.com/sergeyklay/provider-pact-example/actions/workflows/test-contracts.yaml/badge.svg\" alt=\"Test Contracts\" /\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://github.com/sergeyklay/provider-pact-example/actions/workflows/test-code.yaml\"\u003e\n            \u003cimg src=\"https://github.com/sergeyklay/provider-pact-example/actions/workflows/test-code.yaml/badge.svg\" alt=\"Test Code\" /\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://github.com/sergeyklay/provider-pact-example/actions/workflows/lint-oas.yaml\"\u003e\n            \u003cimg src=\"https://github.com/sergeyklay/provider-pact-example/actions/workflows/lint-oas.yaml/badge.svg\" alt=\"Lint OpenAPI\" /\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://codecov.io/gh/sergeyklay/provider-pact-example\" \u003e\n            \u003cimg src=\"https://codecov.io/gh/sergeyklay/provider-pact-example/branch/main/graph/badge.svg?token=2C8W0VZQGN\" alt=\"Coverage Status\"/\u003e\n        \u003c/a\u003e\n    \u003c/p\u003e\n\n.. teaser-begin\n\nThis is a Python application for explanation of Contract Testing based on\n`Pact \u003chttps://docs.pact.io\u003e`_.\n\nHere you can find out how to use Pact using the Python language. You can find\nmore of an overview on Pact in the `Pact Introduction \u003chttps://docs.pact.io/\u003e`_.\n\nThis project uses:\n\n* `Pact \u003chttps://pact.io\u003e`_, a code-first tool for testing HTTP and message\n  integrations using contract tests\n* `pact-python \u003chttps://github.com/pact-foundation/pact-python\u003e`_, to create\n  and verify consumer driven contracts\n* `OpenAPI \u003chttps://swagger.io\u003e`_, to describe the Products API\n* `Flask \u003chttps://flask.palletsprojects.com\u003e`_, a micro web framework for\n  building API\n\n.. teaser-end\n\n.. image:: https://raw.githubusercontent.com/sergeyklay/provider-pact-example/main/cdc-example.png\n  :alt: Interaction diagram\n\nProvider\n========\n\nProvider API Example is a sample Flask application that expose endpoints with\nREST standard. As an example, this project uses the simple Products API. Here\nis the\n`OpenAPI spec \u003chttps://github.com/sergeyklay/provider-pact-example/blob/main/openapi/swagger.yaml\u003e`_\ndescribes the interaction of clients with the provider.\n\nConsumer\n========\n\nFor the purity of the experiment, the consumer is implemented as a separate\nproject and can be found at\n`the following repo \u003chttps://github.com/sergeyklay/consumer-pact-example\u003e`_.\n\nPact\n====\n\nSample contracts (pacts) are located here:\nhttps://github.com/sergeyklay/consumer-pact-example/tree/main/tests/pacts\n\nGetting Started\n===============\n\nPrerequisites\n-------------\n\nWhat kind of things you need to install on your workstation to start:\n\n* Python \u003e= 3.11\n* SQLite3\n* Node.js \u003e= 16\n\nInstalling\n----------\n\nFirst, install Python dependencies for provider (Products API):\n\n.. code-block:: console\n\n   $ make init\n   $ make install\n\n\nCreate provider configuration:\n\n.. code-block:: console\n\n   $ cp .env.example .env\n\nRun database migrations for provider:\n\n.. code-block:: console\n\n   $ make migrate\n\nAdd provider seed data to the database:\n\n.. code-block:: console\n\n   $ make seed\n\nNext, install Node.js linters and tools:\n\n.. code-block:: console\n\n   $ npm install\n\nRun API server\n--------------\n\nTo run API server use the command as follows:\n\n.. code-block:: console\n\n   $ make serve\n\nRun tests\n---------\n\nTo run unit tests use the command as follows:\n\n.. code-block:: console\n\n   $ make test\n\nTo verify contracts (pacts) use the command as follows:\n\n.. code-block:: console\n\n   $ ./tests/run-pytest.sh\n\nNote that before the contracts verification, you must have deployed the broker,\nas well as the contracts must be published.\n\nRun lint check\n--------------\n\nTo run OpenAPI spec checking use the command as follows:\n\n.. code-block:: console\n\n   $ npm run lint\n\n\n.. -project-information-\n\nProject Information\n===================\n\nProvider API Example is released under the `MIT License \u003chttps://choosealicense.com/licenses/mit/\u003e`_,\nand its code lives at `GitHub \u003chttps://github.com/sergeyklay/provider-pact-example\u003e`_.\nIt’s rigorously tested on Python 3.11+.\n\nIf you'd like to contribute to Provider API Example you're most welcome!\n\n.. -support-\n\nSupport\n=======\n\nShould you have any question, any remark, or if you find a bug, or if there is\nsomething you can't do with the Provider API Example, please\n`open an issue \u003chttps://github.com/sergeyklay/provider-pact-example/issues\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeyklay%2Fprovider-pact-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergeyklay%2Fprovider-pact-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeyklay%2Fprovider-pact-example/lists"}