@ -303,6 +303,29 @@ namespace JsonSerializationTests
R " ( { " foo " : [ " bar " , " baz " ] }) " ) ;
R " ( { " foo " : [ " bar " , " baz " ] }) " ) ;
}
}
TEST_F ( JsonPatchingSerializationTests , ApplyPatch_UseJsonPatchRemoveArrayMembersInCorrectOrder_ReportsSuccess )
{
CheckApplyPatch (
R " ( { " foo " : [ " bar " , " qux " , " baz " ] }) " ,
R " ( [
{ " op " : " remove " , " path " : " /foo/2 " } ,
{ " op " : " remove " , " path " : " /foo/1 " }
] ) " ,
R " ( { " foo " : [ " bar " ] }) " ) ;
}
TEST_F ( JsonPatchingSerializationTests , ApplyPatch_UseJsonPatchRemoveArrayMembersInWrongOrder_ReportsError )
{
using namespace AZ : : JsonSerializationResult ;
CheckApplyPatchOutcome (
R " ( { " foo " : [ " bar " , " qux " , " baz " ] }) " ,
R " ( [
{ " op " : " remove " , " path " : " /foo/1 " } ,
{ " op " : " remove " , " path " : " /foo/2 " }
] ) " ,
Outcomes : : Invalid , Processing : : Halted ) ;
}
TEST_F ( JsonPatchingSerializationTests , ApplyPatch_UseJsonPatchRemoveOperationInvalidParent_ReportError )
TEST_F ( JsonPatchingSerializationTests , ApplyPatch_UseJsonPatchRemoveOperationInvalidParent_ReportError )
{
{
using namespace AZ : : JsonSerializationResult ;
using namespace AZ : : JsonSerializationResult ;
@ -949,6 +972,27 @@ namespace JsonSerializationTests
) ;
) ;
}
}
TEST_F ( JsonPatchingSerializationTests , CreatePatch_UseJsonPatchRemoveLastArrayEntries_MultipleOperationsInCorrectOrder )
{
CheckCreatePatch (
R " ( [ " foo " , " hello " , " bar " ]) " , R " ( [ " foo " ]) " ,
R " ( [
{ " op " : " remove " , " path " : " /2 " } ,
{ " op " : " remove " , " path " : " /1 " }
] ) " );
}
TEST_F ( JsonPatchingSerializationTests , CreatePatch_UseJsonPatchRemoveAllArrayEntries_MultipleOperationsInCorrectOrder )
{
CheckCreatePatch (
R " ( [ " foo " , " hello " , " bar " ]) " , R " ( []) " ,
R " ( [
{ " op " : " remove " , " path " : " /2 " } ,
{ " op " : " remove " , " path " : " /1 " } ,
{ " op " : " remove " , " path " : " /0 " }
] ) " );
}
TEST_F ( JsonPatchingSerializationTests , CreatePatch_UseJsonPatchRemoveObjectFromArrayInMiddle_OperationToUpdateMember )
TEST_F ( JsonPatchingSerializationTests , CreatePatch_UseJsonPatchRemoveObjectFromArrayInMiddle_OperationToUpdateMember )
{
{
CheckCreatePatch (
CheckCreatePatch (