citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
456 stars 134 forks source link

Revert JsonArray order validation #1157

Closed novarx closed 4 months ago

novarx commented 4 months ago

Citrus Version v4.2.0

With v4.2.0 the behaviour of the JSON validation changed and json-array order was not checked anymore. This is a breaking change and should be introduced in another way (i.e. by configuring it explicitly)

So this behaviour should be fixed

Expected behavior The validation of a given JSON array, compared to a control JSON, should not ignore the order of array items. i.e. the following "recived-json".

{ "books": ["book-c", "book-b", "book-a"] }

Should throw ValidationException when compared with the following "control-json"

{ "books": ["book-a", "book-b", "book-c"] }

On the other hand, missing elements should not yield an Exception in "soft" mode:

i.e. the following "recived-json".

{ "books": ["book-a", "book-b", "book-c"] }

should not throw ValidationException when compared with the following "control-json"

{ "books": ["book-a", "book-b"] }
or
{ "books": ["book-b", "book-c"] }
or
{ "books": ["book-a", "book-c"] }

Actual behavior Array order should be checked whether in "strict" or "soft" mode of JSON validation.