-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
demo: add examples qs warning/add req body properties
- Loading branch information
Showing
4 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
test/example-contracts/extraRequestProperty/v2/addtional_request_body_property_v2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"consumer": { | ||
"name": "DefaultApi-consumer" | ||
}, | ||
"interactions": [ | ||
{ | ||
"description": "A POST request for createProduct", | ||
"providerStates": [ | ||
{ | ||
"name": "createProduct is available on DefaultApi service" | ||
} | ||
], | ||
"request": { | ||
"body": { | ||
"id": "1234", | ||
"name": "burger", | ||
"price": 42, | ||
"type": "food", | ||
"foo": "bar" | ||
}, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"method": "POST", | ||
"path": "/products" | ||
}, | ||
"response": { | ||
"body": { | ||
"id": "1234", | ||
"name": "burger", | ||
"price": 42, | ||
"type": "food" | ||
}, | ||
"headers": { | ||
"Content-Type": "application/json;charset=utf-8" | ||
}, | ||
"status": 200 | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"pact-js": { | ||
"version": "12.5.0" | ||
}, | ||
"pactRust": { | ||
"ffi": "0.4.20", | ||
"models": "1.2.0" | ||
}, | ||
"pactSpecification": { | ||
"version": "3.0.0" | ||
} | ||
}, | ||
"provider": { | ||
"name": "DefaultApi" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Product API | ||
description: PactFlow Product API demo | ||
version: 1.0.0 | ||
paths: | ||
/products: | ||
post: | ||
summary: Create a product | ||
description: Creates a new product | ||
operationId: createProduct | ||
requestBody: | ||
description: Create a new Product | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Product' | ||
examples: | ||
application/json: | ||
value: | ||
id: "1234" | ||
type: "food" | ||
price: 42 | ||
responses: | ||
"200": | ||
description: successful operation | ||
content: | ||
"application/json; charset=utf-8": | ||
schema: | ||
$ref: '#/components/schemas/Product' | ||
examples: | ||
application/json: | ||
value: | ||
id: "1234" | ||
type: "food" | ||
price: 42 | ||
get: | ||
summary: List all products | ||
description: Returns all products | ||
operationId: getAllProducts | ||
responses: | ||
"200": | ||
description: successful operation | ||
content: | ||
"application/json; charset=utf-8": | ||
schema: | ||
type: "array" | ||
items: | ||
$ref: '#/components/schemas/Product' | ||
examples: | ||
application/json: | ||
value: | ||
- id: "1234" | ||
type: "food" | ||
price: 42 | ||
# name: "pizza" | ||
# version: "1.0.0" | ||
# see https://github.com/apiaryio/dredd/issues/1430 for why | ||
"400": | ||
description: Invalid ID supplied | ||
content: {} | ||
/product/{id}: | ||
get: | ||
summary: Find product by ID | ||
description: Returns a single product | ||
operationId: getProductByID | ||
parameters: | ||
- name: id | ||
in: path | ||
description: ID of product to get | ||
schema: | ||
type: string | ||
required: true | ||
example: 10 | ||
responses: | ||
"200": | ||
description: successful operation | ||
content: | ||
"application/json; charset=utf-8": | ||
schema: | ||
$ref: '#/components/schemas/Product' | ||
examples: | ||
application/json: | ||
value: | ||
id: "1234" | ||
type: "food" | ||
price: 42 | ||
# name: "pizza" | ||
# version: "1.0.0" | ||
# see https://github.com/apiaryio/dredd/issues/1430 for why | ||
"400": | ||
description: Invalid ID supplied | ||
content: {} | ||
"404": | ||
description: Product not found | ||
content: {} | ||
components: | ||
schemas: | ||
Product: | ||
type: object | ||
required: | ||
- id | ||
- name | ||
- price | ||
properties: | ||
id: | ||
type: string | ||
type: | ||
type: string | ||
name: | ||
type: string | ||
version: | ||
type: string | ||
price: | ||
type: number |
59 changes: 59 additions & 0 deletions
59
test/example-contracts/queryString/v2/query_param_pact_v2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"consumer": { | ||
"name": "pactflow-example-bi-directional-consumer-cypress" | ||
}, | ||
"provider": { | ||
"name": "pactflow-example-bi-directional-provider-postman" | ||
}, | ||
"interactions": [ | ||
{ | ||
"description": "displays product item by query", | ||
"providerState": "", | ||
"request": { | ||
"method": "GET", | ||
"path": "/products", | ||
"headers": { | ||
"accept": "application/json, text/plain, */*", | ||
"authorization": "Bearer 2024-03-13T18:05:40.611Z" | ||
}, | ||
"body": "", | ||
"query": "id=2" | ||
}, | ||
"response": { | ||
"status": 200, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": [ | ||
{ | ||
"id": "09", | ||
"type": "CREDIT_CARD", | ||
"name": "Gem Visa", | ||
"price": 99.99 | ||
}, | ||
{ | ||
"id": "10", | ||
"type": "CREDIT_CARD", | ||
"name": "28 Degrees", | ||
"price": 49.49 | ||
}, | ||
{ | ||
"id": "11", | ||
"type": "PERSONAL_LOAN", | ||
"name": "MyFlexiPay", | ||
"price": 16.5 | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"pactSpecification": { | ||
"version": "2.0.0" | ||
}, | ||
"client": { | ||
"name": "pact-cypress-adapter", | ||
"version": "1.3.0" | ||
} | ||
} | ||
} |