Generated Pact-compatible consumer contract does not contain description #703

Closed
opened 2025-12-29 15:31:26 +01:00 by adam · 6 comments
Owner

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 for description.

Yet, it is the description that will show up in PactFlow. It is now empty:

Image

Expected behavior:

I expect the value supplied in the WithTitle() method to be mapped to a field called description in the Pact-compatible contract, not to a field called providerState.

As far as I can see, It's OK to simply change the mapping and leave out the providerState field 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 the key and pending fields, too):

Image

Test to reproduce

N/A

Happy to dive into this and create a PR myself, if you would like me to, @StefH.

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 for `description`. Yet, it is the `description` that will show up in PactFlow. It is now empty: <img width="610" height="322" alt="Image" src="https://github.com/user-attachments/assets/bbc2f458-fa3a-4b80-b49b-40dcc77a654c" /> ### Expected behavior: I expect the value supplied in the `WithTitle()` method to be mapped to a field called `description` in the Pact-compatible contract, not to a field called `providerState`. As far as I can see, It's OK to simply change the mapping and leave out the `providerState` field 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 the `key` and `pending` fields, too): <img width="492" height="191" alt="Image" src="https://github.com/user-attachments/assets/c2192580-7c46-4f7a-b9fa-be3142a859a4" /> ### 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.
adam added the bug label 2025-12-29 15:31:26 +01:00
adam closed this issue 2025-12-29 15:31:26 +01:00
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Author
Owner

@StefH commented on GitHub (Jul 16, 2025):

I can also fix it and add you as reviewer.

@StefH commented on GitHub (Jul 16, 2025): I can also fix it and add you as reviewer.
Author
Owner

@StefH commented on GitHub (Jul 16, 2025):

https://github.com/wiremock/WireMock.Net/pull/1331

@StefH commented on GitHub (Jul 16, 2025): https://github.com/wiremock/WireMock.Net/pull/1331
Author
Owner

@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?

@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?
Author
Owner

@basdijkstra commented on GitHub (Jul 17, 2025):

@StefH apologies, yesterday was a bit all over the place. I'll take a look this morning.

@basdijkstra commented on GitHub (Jul 17, 2025): @StefH apologies, yesterday was a bit all over the place. I'll take a look this morning.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#703