-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex support for JsonMatcher #1088
Comments
@pluma9 Is there a reason you cannot use the JsonPartialMatcher ? |
Thanks. That is because I want to assert that the request contains exactly certain fields. Adding more fields may make the real API server returns an error. |
I've added this logic, can you please test preview version See https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions |
Thanks very much. It works great in terms of regex. There seems to be a regression. {
"Contact": {
"Phone": "1234",
"Street": "King Street"
},
"Info": {
"Occupation": "Developer"
}
} In previous versions, it does not match the following body: {
"Contact": {
"Phone": "1234",
"Street": "King Street"
},
"Info": {
"Occupation": "Developer"
},
"OtherInfo": {
"NickName": "Jimmy"
}
} However, in WireMock.Net.1.5.51-ci-18462, it does |
I see. I need to adjust the logic to match exact. I'll check tomorrow. |
@pluma9 Can you please test preview |
The previous case works great now. However, there is one more case. Given the matcher above, the following body does not match (expected): {
"Contact": {
"Phone": "1234",
"Street": "King Street"
},
"Info": {
"Occupation": "Dancer"
}
} The following body oddly matches: {
"Contact": {
"Phone": "1234",
"Street": "King Street"
},
"Info": {
"Occupation": "Developer2"
}
} |
All strings should be defined as valid regular expressions. So in this case like this:
|
Ah, I see. Then things work great now. I really appreciate your support. |
I'll merge the PR and create a new normal NuGet soon. |
Is your feature request related to a problem? Please describe.
I'd like to use regex in JsonMatcher (just like in JsonPartialMatcher)
Describe the solution you'd like
Add the option to turn on regex. Similar to: https://github.com/WireMock-Net/WireMock.Net/wiki/Request-Matching-JsonPartialMatcher#use-regex
Describe alternatives you've considered
No alternative solution I can think of
Is your feature request supported by WireMock (java version)? Please provide details.
I am not sure. Please let know if this is important. I can do some more research.
Additional context
No.
The text was updated successfully, but these errors were encountered: