Hello, In scope of bidirectional contract testing,...
# pactflow
m
Hello, In scope of bidirectional contract testing, when the body of a response is same in both consumer and provider contracts. But still I am getting incompatibility errors for all fields. Any help or fix here
b
Can you give us some more information here? Can you share your contracts? Example message payloads? The error messages you see? My crystal ball is broken.
m
newman-run-report-2023-08-31-05-48-51-177-0.json,swagger.yml,ProductConsumer-OneProvider.json
Copy code
Response.Body.Incompatible
Response body is incompatible with the response body schema in the spec file: must NOT have additional properties - limit

[root].interactions[0].response.body = {"limit":1,"products":[{"brand":"Apple","category":"smartphones","description":"An apple mobile which is nothing like apple","discountPercentage":12.96,"id":1,"images":["<https://i.dummyjson.com/data/products/1/1.jpg>","<https://i.dummyjson.com/data/products/1/2.jpg>","<https://i.dummyjson.com/data/products/1/3.jpg>","<https://i.dummyjson.com/data/products/1/4.jpg>","<https://i.dummyjson.com/data/products/1/thumbnail.jpg>"],"price":549,"rating":4.69,"stock":94,"thumbnail":"<https://i.dummyjson.com/data/products/1/thumbnail.jpg>","title":"iPhone 9"}],"skip":0,"total":100}
Response.Body.Incompatible
Response body is incompatible with the response body schema in the spec file: must NOT have additional properties - products

[root].interactions[0].response.body = {"limit":1,"products":[{"brand":"Apple","category":"smartphones","description":"An apple mobile which is nothing like apple","discountPercentage":12.96,"id":1,"images":["<https://i.dummyjson.com/data/products/1/1.jpg>","<https://i.dummyjson.com/data/products/1/2.jpg>","<https://i.dummyjson.com/data/products/1/3.jpg>","<https://i.dummyjson.com/data/products/1/4.jpg>","<https://i.dummyjson.com/data/products/1/thumbnail.jpg>"],"price":549,"rating":4.69,"stock":94,"thumbnail":"<https://i.dummyjson.com/data/products/1/thumbnail.jpg>","title":"iPhone 9"}],"skip":0,"total":100}
Response.Body.Incompatible
Response body is incompatible with the response body schema in the spec file: must NOT have additional properties - skip

[root].interactions[0].response.body = {"limit":1,"products":[{"brand":"Apple","category":"smartphones","description":"An apple mobile which is nothing like apple","discountPercentage":12.96,"id":1,"images":["<https://i.dummyjson.com/data/products/1/1.jpg>","<https://i.dummyjson.com/data/products/1/2.jpg>","<https://i.dummyjson.com/data/products/1/3.jpg>","<https://i.dummyjson.com/data/products/1/4.jpg>","<https://i.dummyjson.com/data/products/1/thumbnail.jpg>"],"price":549,"rating":4.69,"stock":94,"thumbnail":"<https://i.dummyjson.com/data/products/1/thumbnail.jpg>","title":"iPhone 9"}],"skip":0,"total":100}
Response.Body.Incompatible
Response body is incompatible with the response body schema in the spec file: must NOT have additional properties - total

[root].interactions[0].response.body = {"limit":1,"products":[{"brand":"Apple","category":"smartphones","description":"An apple mobile which is nothing like apple","discountPercentage":12.96,"id":1,"images":["<https://i.dummyjson.com/data/products/1/1.jpg>","<https://i.dummyjson.com/data/products/1/2.jpg>","<https://i.dummyjson.com/data/products/1/3.jpg>","<https://i.dummyjson.com/data/products/1/4.jpg>","<https://i.dummyjson.com/data/products/1/thumbnail.jpg>"],"price":549,"rating":4.69,"stock":94,"thumbnail":"<https://i.dummyjson.com/data/products/1/thumbnail.jpg>","title":"iPhone 9"}],"skip":0,"total":100}
m
You haven’t defined a schema for the endpoint in your OAS file, just an example
if you put the OAS into https://editor.swagger.io/, and look at the schema for the endpoint response, you’ll note it’s empty (don’t look at the “Example Value” section, because that uses what you have defined by default.
m
From this repo - https://github.com/pactflow/example-bi-directional-provider-postman/tree/master When i manually converted the postman collection to OAS file, the file generated does not have schema related details. Is it a manual effort to explicitly add schema details into oas file after conversion ?
b
The provider OpenAPI spec is in that project already, no need to convert it yourself, with all the things that can potentially go wrong there: https://github.com/pactflow/example-bi-directional-provider-postman/tree/master/oas
m
The postman to API tool should do that, but perhaps for some reason it's not working. The OAS is the key artefact we need though, and without a schema it's useless