mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
JsonPartialMatcher - match guid and string #529
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 @timurnes on GitHub (Jul 19, 2023).
As a WireMock user I'd like to setup JsonPartialMatcher using anonymous object with some Guid fields.
As of now I have to cast Guid fields to string because this condition in AbstractJsonPartialMatcher rejects match - value type is JTokenType.Guid and input type is JTokenType.String.
Generally, guid in json is a string so I think this feature can simplify user code a bit and won't be a breaking change
Possible solution is to add a check before the condition I've specified above
Unit test in JsonPartialMatcherTests:
@StefH commented on GitHub (Jul 19, 2023):
@timurnes
Looks ok to me.
Can you make a PR with code change + unit tests?
However I think that this same logic needs to be applied to line 66 if a Regex is used:
@timurnes commented on GitHub (Jul 19, 2023):
@StefH
Created PR #972
I haven't added any changes to Regex logic because I can't imagine how we can create valid regex with Guid type. So Guid field will be skipped and matched on the next condition that is added with this PR