You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we recently upgraded to Rest Docs 2.0.0 from 1.1.2.
The behaviour of JsonFieldProcessor#foundMatch() has changed, so that some json-attributes are marked as missing (although) present (according to 1.1.2 #foundMatch()).
The reason is that in 1.1.2 it was sufficient when the searched json-attribute (key) is present in the processingContext#getPayload() map. Just 'true' was returned then.
But in 2.0.0 the #foundMatch() method combine certain MatchTypes (in my case MatchType.ABSENT with MatchType.NON_NULL) when the searched json-attribute (key) is present in the processingContext#getPayload() map.
So the foundMatch() method finally returns the value MatchType.MIXED.
BUT JsonFieldProcessor#fieldFound() only returns true the resulting MatchType is MatchType.NON_NULL or MatchType.NULL.
I searched for:
fieldWithPath("[].myArray[].mySearchedAttribute").
Maybe it has something to do with the fact that 'myArray' is only present in the second Array-Element (I didn't mark the fieldWithPath as optional as in my UnitTest it shall occure in the response).
But it was okay in RestDocs 1.1.2.
Any idea?
The text was updated successfully, but these errors were encountered:
Hi there,
we recently upgraded to Rest Docs 2.0.0 from 1.1.2.
The behaviour of JsonFieldProcessor#foundMatch() has changed, so that some json-attributes are marked as missing (although) present (according to 1.1.2 #foundMatch()).
The reason is that in 1.1.2 it was sufficient when the searched json-attribute (key) is present in the processingContext#getPayload() map. Just 'true' was returned then.
But in 2.0.0 the #foundMatch() method combine certain MatchTypes (in my case MatchType.ABSENT with MatchType.NON_NULL) when the searched json-attribute (key) is present in the processingContext#getPayload() map.
So the foundMatch() method finally returns the value MatchType.MIXED.
BUT JsonFieldProcessor#fieldFound() only returns true the resulting MatchType is MatchType.NON_NULL or MatchType.NULL.
It looks like a bug to me.
My Testdata:
Travesed JSON (Debug-Output):
[ {id=18},
{id=19, myArray=[ {mySearchedAttribute=someValue, formular=B} ]},
{id=20} ]
I searched for:
fieldWithPath("[].myArray[].mySearchedAttribute").
Maybe it has something to do with the fact that 'myArray' is only present in the second Array-Element (I didn't mark the fieldWithPath as optional as in my UnitTest it shall occure in the response).
But it was okay in RestDocs 1.1.2.
Any idea?
The text was updated successfully, but these errors were encountered: