openapi: 3.0.0
info:
title: Product Service API
version: 1.0.0
paths:
/products:
get:
summary: Get all products
responses:
'200':
description: A list of products
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
/products/{id}:
get:
summary: Get product by ID
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: A product object
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
components:
schemas:
Product:
type: object
properties:
id:
type: string
name:
type: string
required:
- id
- name
{
"consumer": {
"name": "ApiClient"
},
"interactions": [
{
"description": "Get product by ID",
"request": {
"method": "GET",
"path": "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/products/10"
},
"response": {
"body": {
"id": "10",
"name": "Test"
},
"matchingRules": {
"$.body": {
"match": "type"
}
},
"status": 200
}
},
{
"description": "Get all products",
"request": {
"method": "GET",
"path": "/products"
},
"response": {
"body": [
{
"id": "09",
"name": "Test"
}
],
"matchingRules": {
"$.body": {
"match": "type",
"min": 1
}
},
"status": 200
}
}
],
"metadata": {
"pact-js": {
"version": "12.1.0"
},
"pactRust": {
"ffi": "0.4.19",
"models": "1.1.19"
},
"pactSpecification": {
"version": "2.0.0"
}
},
"provider": {
"name": "Product Service API"
}
}
Source format: OpentAPI(https://swagger.io/specification/)
Destination format: Pact(https://github.com/pact-foundation/pact-specification/tree/version-3)
Example
Source OpenAPI file:
Destination Pact-file: