mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Generated Pact-compatible consumer contract does not contain description #703
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @basdijkstra on GitHub (Jul 16, 2025).
Originally assigned to: @StefH on GitHub.
Describe the bug
When I generate a Pact-compatible consumer contract based on WireMock.Net traffic, for every interaction, the contract contains an entry for
providerState, but not fordescription.Yet, it is the
descriptionthat will show up in PactFlow. It is now empty:Expected behavior:
I expect the value supplied in the
WithTitle()method to be mapped to a field calleddescriptionin the Pact-compatible contract, not to a field calledproviderState.As far as I can see, It's OK to simply change the mapping and leave out the
providerStatefield altogether, as that isn't used in bidirectional contract testing, anyway. WireMock in Java does the exact same thing (image shows contract generated by WireMock in Java, you can ignore thekeyandpendingfields, too):Test to reproduce
N/A
Other related info
Happy to dive into this and create a PR myself, if you would like me to, @StefH.
@StefH commented on GitHub (Jul 16, 2025):
@basdijkstra
Can you make a PR.
I think you need to change this code:
https://github.com/wiremock/WireMock.Net/blob/master/src/WireMock.Net.Minimal/Serialization/PactMapper.cs#L45
So in case a description is set on the mapping use that one, else use the title and remove providerState mapping.
@basdijkstra commented on GitHub (Jul 16, 2025):
@StefH I'd be happy to. Will do that somewhere in the next few days once I find a bit of spare time.
@StefH commented on GitHub (Jul 16, 2025):
I can also fix it and add you as reviewer.
@StefH commented on GitHub (Jul 16, 2025):
https://github.com/wiremock/WireMock.Net/pull/1331
@StefH commented on GitHub (Jul 17, 2025):
@basdijkstra
I did create a PR, see https://github.com/wiremock/WireMock.Net/pull/1331, can you review it?
@basdijkstra commented on GitHub (Jul 17, 2025):
@StefH apologies, yesterday was a bit all over the place. I'll take a look this morning.