vendredi 2 novembre 2018

Using json schema within pact for contract testing

I started experiencing pact a while a ago, and I'm wondering if any of you guys has any idea if pact support Json schemas!

I'll describe the flow. suppose you have two microservices:

  • Microservice A - the consumer
  • Microservice B - the Provider

The provider exposes an Api - basically a POST request and expects an explicit json body payload (some field are required). Let's say:

{
  "id": "123",
  "name": "Bob"
}

both id and name are required properties.

Suppose now that the provider changed it's behaviour to expect the same json payload but with an additional property:

{
  "id": "123",
  "name": "Bob"
  "extraProperty": "newProperty"
}

My question is is there anyway to detect such breaking contract using pact framework? if not what do think is the best way to test such scenario.

Thanks for the help.

Aucun commentaire:

Enregistrer un commentaire