Dynamic values in OpenAPI Example requests #1136
Unanswered
noelmccrory
asked this question in
Ask For Help
Replies: 1 comment
-
Hey @noelmccrory, thanks for starting this thread. This is a very good scenario that you have brought up. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of the endpoints on my API accepts a
startDate
field in the request body. The API also has validation to ensure that the startDate is no more than 5 days in the past, and no more than 5 days in the future. In the example for this endpoint in the OpenAPI Spec I can specify today's date and the Contract Tests will pass successfully. However, in 6 days the Contract Test for this endpoint will fail because a 400 will be returned.Is there any way to provide dynamic values in examples in OpenAPI Specs? I couldn't see anything in the Specmatic documentation or previous issues/discussions on this.
The only alternative I can think of at this point would be to mock out the Clock instance on the service, so that today is always a fixed date.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions