doc/pacts/markdown/Pact Broker Client - PactFlow

A pact between Pact Broker Client and PactFlow

Requests from Pact Broker Client to PactFlow

Interactions


Upon receiving a request for the index resource from Pact Broker Client, with

{
  "method": "get",
  "path": "/",
  "headers": {
    "Accept": "application/hal+json"
  }
}

PactFlow will respond with:

{
  "status": 200,
  "headers": {
    "Content-Type": "application/hal+json;charset=utf-8"
  },
  "body": {
    "_links": {
      "pb:webhooks": {
        "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PB-WEBHOOKS"
      },
      "pb:pacticipants": {
        "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PB-PACTICIPANTS"
      },
      "pb:pacticipant": {
        "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-{pacticipant}"
      }
    }
  }
}


Given the pb:publish-provider-contract relation exists in the index resource, upon receiving a request for the index resource from Pact Broker Client, with

{
  "method": "GET",
  "path": "/",
  "headers": {
    "Accept": "application/hal+json"
  }
}

PactFlow will respond with:

{
  "status": 200,
  "headers": {
    "Content-Type": "application/hal+json;charset=utf-8"
  },
  "body": {
    "_links": {
      "pf:publish-provider-contract": {
        "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PF-PUBLISH-PROVIDER-CONTRACT-{provider}"
      }
    }
  }
}


Upon receiving a request to create a provider contract from Pact Broker Client, with

{
  "method": "put",
  "path": "/contracts/provider/Bar/version/1",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/hal+json"
  },
  "body": {
    "content": "LS0tCnNvbWU6IGNvbnRyYWN0Cg==",
    "contractType": "oas",
    "contentType": "application/yaml",
    "verificationResults": {
      "success": true,
      "content": "c29tZSByZXN1bHRz",
      "contentType": "text/plain",
      "format": "text",
      "verifier": "my custom tool",
      "verifierVersion": "1.0"
    }
  }
}

PactFlow will respond with:

{
  "status": 201,
  "headers": {
    "Content-Type": "application/hal+json;charset=utf-8"
  }
}


Given there is a pf:ui href in the response, upon receiving a request to create a provider contract from Pact Broker Client, with

{
  "method": "put",
  "path": "/contracts/provider/Bar/version/1",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/hal+json"
  },
  "body": {
    "content": "LS0tCnNvbWU6IGNvbnRyYWN0Cg==",
    "contractType": "oas",
    "contentType": "application/yaml",
    "verificationResults": {
      "success": true,
      "content": "c29tZSByZXN1bHRz",
      "contentType": "text/plain",
      "format": "text",
      "verifier": "my custom tool",
      "verifierVersion": "1.0"
    }
  }
}

PactFlow will respond with:

{
  "status": 201,
  "headers": {
    "Content-Type": "application/hal+json;charset=utf-8"
  },
  "body": {
    "_links": {
      "pf:ui": {
        "href": "some-url"
      }
    }
  }
}


Given a team with UUID 2abbc12a-427d-432a-a521-c870af1739d9 exists, upon receiving a request to create a webhook for a team from Pact Broker Client, with

{
  "method": "post",
  "path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/hal+json"
  },
  "body": {
    "description": "a webhook",
    "events": [
      {
        "name": "contract_content_changed"
      }
    ],
    "request": {
      "url": "https://webhook",
      "method": "POST",
      "headers": {
        "Foo": "bar",
        "Bar": "foo"
      },
      "body": {
        "some": "body"
      }
    },
    "teamUuid": "2abbc12a-427d-432a-a521-c870af1739d9"
  }
}

PactFlow will respond with:

{
  "status": 201,
  "headers": {
    "Content-Type": "application/hal+json;charset=utf-8"
  },
  "body": {
    "description": "a webhook",
    "teamUuid": "2abbc12a-427d-432a-a521-c870af1739d9",
    "_links": {
      "self": {
        "href": "http://localhost:1234/some-url",
        "title": "A title"
      }
    }
  }
}


Upon receiving a request to publish a provider contract from Pact Broker Client, with

{
  "method": "post",
  "path": "/HAL-REL-PLACEHOLDER-PF-PUBLISH-PROVIDER-CONTRACT-Bar",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/hal+json,application/problem+json"
  },
  "body": {
    "pacticipantVersionNumber": "1",
    "tags": [
      "dev"
    ],
    "branch": "main",
    "buildUrl": "http://build",
    "contract": {
      "content": "LS0tCnNvbWU6IGNvbnRyYWN0Cg==",
      "contentType": "application/yaml",
      "specification": "oas",
      "selfVerificationResults": {
        "success": true,
        "content": "c29tZSByZXN1bHRz",
        "contentType": "text/plain",
        "format": "text",
        "verifier": "my custom tool",
        "verifierVersion": "1.0"
      }
    }
  }
}

PactFlow will respond with:

{
  "status": 200,
  "headers": {
    "Content-Type": "application/hal+json;charset=utf-8"
  },
  "body": {
    "notices": [
      {
        "text": "some notice",
        "type": "info"
      }
    ],
    "_embedded": {
      "version": {
        "number": "1"
      }
    },
    "_links": {
      "pb:pacticipant-version-tags": [
        {
        }
      ],
      "pb:branch-version": {
      }
    }
  }
}