Hey all wondering if anyone has any tips on if thi...
# help
t
Hey all wondering if anyone has any tips on if this is possible: I have a wiremock stub thats has these params: "bodyPatterns": [{ "matchesJsonPath": "$[?(@.xyy == 'abc' && @.Date=='01-01-2023)]" }] I'm wondering - even thought "Date" is being parsed though is there anyway I can match by year rather than "Date", so @.Date == "2023" would just check the year of the date in the post call?
t
You can do this by using the sub-matcher format of
matchesJsonPath
along with one of the date matchers. Something alone these lines:
Copy code
"bodyPatterns": [
            {
                "matchesJsonPath": {
                    "expression": "$.completedDate",
                    "equalToDateTime": "2023-01-01",
                    "truncateActual": "first day of month"
                }
            }
        ]