spring-cloud-contract
spring-cloud-contract copied to clipboard
Generate tests with and without optional fields
It would be nice to be able to mark fields as optional and for a test to be generated with and without the optional field.
For example:
In my body I have email: $(consumer(optional(regex(email()))), producer('[email protected]')
Then two tests would be generated locally in the producer, one with email in the payload, and one without.
Would be nice to have that indeed. In our model we have quite a few optional fields and creating separate contracts for each permutation is quite cumbersome