Consumer and Provider services specification examples data should be aligned in specific scenarios #1106
-
In our Specmatic evaluation process, we've developed a sample use case featuring Customer Service as the requester and Order Service as the supplier. Use Case : Customer Service initiates a request to the Order Service, seeking an order associated with a specific customer ID. Upon receiving the response, it verifies the response customer ID with input customer ID as part of validate the information. Business Logic:
[
{
"orderId": "ORD004",
"customerId": 1004,
"placeDate": '2022-01-01',
"completionDate": '2022-01-02'
},
{
"orderId": "ORD009",
"customerId": 1082,
"placeDate": '2024-04-22',
"completionDate": '2024-04-23'
}
]
Currently, we are aligning the examples across the customer and order open API specifications to ensure the success of this particular use case. However, achieving alignment in all instances poses a significant challenge. Is there a strategy we can employ to navigate through this situation effectively? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @gurubabujampala , thanks for the details. The inline examples in OpenAPI spec act as static stubs. Please have a look at Specmatic dynamic expectations. Dynamic expectations can be set programmatically within your test (in We are also working on a feature which will allow you to setup dynamic stubbing behaviour within the OpenAPI spec itself. We will share more on this shortly. Hope this helps. Thanks. |
Beta Was this translation helpful? Give feedback.
Hi @gurubabujampala, Specmatic now has the ability to substitute values in the response based on what is received in the request.
This is exactly what you are looking for in terms of
customerId
.Here is the documentation for the same.
Please take a look and let us know your feedback.