spring-cloud-contract icon indicating copy to clipboard operation
spring-cloud-contract copied to clipboard

Generate tests with and without optional fields

Open CaptainMorgs opened this issue 4 years ago • 1 comments

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.

CaptainMorgs avatar Nov 29 '19 13:11 CaptainMorgs

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

artemy avatar Aug 05 '22 15:08 artemy