johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnold Robert Turdean (Jira)" <j...@apache.org>
Subject [jira] [Updated] (JOHNZON-312) JsonPatch's add operation updates unexpected fields
Date Thu, 07 May 2020 00:00:12 GMT

     [ https://issues.apache.org/jira/browse/JOHNZON-312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Arnold Robert Turdean updated JOHNZON-312:
------------------------------------------
    Description: 
Recently we found an important bug with the Johnzon framework. It's easy to reproduce and
the fix seems important. The add operation is not working 100% well for nested objects. (in
my example for a map which contains a list in the value)

Example:

Data:

 
{code:java}
{
...
  "caseDiscussionDailySchedule":{
    "schedule":{
      "TUESDAY":[
        {
          "start":"07:00+03:00",
          "end":"08:00+03:00"
        }
      ],
      "MONDAY":[
        {
          "start":"07:00+03:00",
          "end":"08:00+03:00"
        }
      ]
    }
  },
  ...
}
{code}
 

 

Operation:

 
{code:java}
[ {"op": "replace", "path": "/caseDiscussionDailySchedule/schedule/MONDAY/0/start", "value":
null} ]
{code}
 

 

I expect that the result should be this:

 
{code:java}
{
...
  "caseDiscussionDailySchedule":{
    "schedule":{
      "TUESDAY":[
        {
          "start":null, <---------------------
          "end":"08:00+03:00"
        }
      ],
      "MONDAY":[
        {
          "start":"07:00+03:00",
          "end":"08:00+03:00"
        }
      ]
    }
  },
  ...
}
{code}
 

 

, but because of the mentioned bug the result is:

 
{code:java}
{
...
  "caseDiscussionDailySchedule":{
    "schedule":{
      "TUESDAY":[
        {
          "start":null, <---------------------
          "end":"08:00+03:00"
        }
      ],
      "MONDAY":[
        {
          "start":null, <---------------------
          "end":"08:00+03:00"
        }
      ]
    }
  },
  ...
}
{code}
 

 

It seems to me that the bug is in the JsonPointerImpl's isPositionToAdd method while it checks
only the parent element's equivalence, instead of checking the whole path's equivalence. (I'm
not 100% sure of that)

Could you fix somehow the mentioned problem ? It would be very important for us and I guess
that for a lot of other people as well.

 

Thank you so much,

                       have a nice day.

  was:
Recently we found an important bug with the Johnzon framework. It's easy to reproduce and
the fix seems important. The add operation is not working 100% well for nested objects. (in
my example for a map which contains a list in the value)

Example:

Data:

 
{code:java}
{
...
  "caseDiscussionDailySchedule":{
    "schedule":{
      "TUESDAY":[
        {
          "start":"07:00+03:00",
          "end":"08:00+03:00"
        }
      ],
      "MONDAY":[
        {
          "start":"07:00+03:00",
          "end":"08:00+03:00"
        }
      ]
    }
  },
  ...
}
{code}
 

 

Operation:

 
{code:java}
[ {"op": "replace", "path": "/caseDiscussionDailySchedule/schedule/MONDAY/0/start", "value":
null} ]
{code}
 

 

I expect that the result should be this:

 
{code:java}
{
...
  "caseDiscussionDailySchedule":{
    "schedule":{
      "TUESDAY":[
        {
          "start":null, <---------------------
          "end":"08:00+03:00"
        }
      ],
      "MONDAY":[
        {
          "start":"07:00+03:00",
          "end":"08:00+03:00"
        }
      ]
    }
  },
  ...
}
{code}
 

 

, but because of the mentioned bug the result is:

 
{code:java}
{
...
  "caseDiscussionDailySchedule":{
    "schedule":{
      "TUESDAY":[
        {
          "start":null, <---------------------
          "end":"08:00+03:00"
        }
      ],
      "MONDAY":[
        {
          "start":null, <---------------------
          "end":"08:00+03:00"
        }
      ]
    }
  },
  ...
}
{code}
 

 

It seems to me that the bug is in the JsonPointerImpl's isPositionToAdd method while it checks
only the parent element's equivalence, instead of checking the whole path's equivalence. (I'm
not 100% sure of that)


Could you fix somehow the mentioned problem ? It would be very important for us and I guess
that for a lot of other people as well.


Thank you so much,

have a nice day,

Arnold Robert Turdean


> JsonPatch's add operation updates unexpected fields
> ---------------------------------------------------
>
>                 Key: JOHNZON-312
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-312
>             Project: Johnzon
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.3, 1.2.5
>            Reporter: Arnold Robert Turdean
>            Priority: Major
>              Labels: easyfix, patch
>             Fix For: 1.2.6
>
>
> Recently we found an important bug with the Johnzon framework. It's easy to reproduce
and the fix seems important. The add operation is not working 100% well for nested objects.
(in my example for a map which contains a list in the value)
> Example:
> Data:
>  
> {code:java}
> {
> ...
>   "caseDiscussionDailySchedule":{
>     "schedule":{
>       "TUESDAY":[
>         {
>           "start":"07:00+03:00",
>           "end":"08:00+03:00"
>         }
>       ],
>       "MONDAY":[
>         {
>           "start":"07:00+03:00",
>           "end":"08:00+03:00"
>         }
>       ]
>     }
>   },
>   ...
> }
> {code}
>  
>  
> Operation:
>  
> {code:java}
> [ {"op": "replace", "path": "/caseDiscussionDailySchedule/schedule/MONDAY/0/start", "value":
null} ]
> {code}
>  
>  
> I expect that the result should be this:
>  
> {code:java}
> {
> ...
>   "caseDiscussionDailySchedule":{
>     "schedule":{
>       "TUESDAY":[
>         {
>           "start":null, <---------------------
>           "end":"08:00+03:00"
>         }
>       ],
>       "MONDAY":[
>         {
>           "start":"07:00+03:00",
>           "end":"08:00+03:00"
>         }
>       ]
>     }
>   },
>   ...
> }
> {code}
>  
>  
> , but because of the mentioned bug the result is:
>  
> {code:java}
> {
> ...
>   "caseDiscussionDailySchedule":{
>     "schedule":{
>       "TUESDAY":[
>         {
>           "start":null, <---------------------
>           "end":"08:00+03:00"
>         }
>       ],
>       "MONDAY":[
>         {
>           "start":null, <---------------------
>           "end":"08:00+03:00"
>         }
>       ]
>     }
>   },
>   ...
> }
> {code}
>  
>  
> It seems to me that the bug is in the JsonPointerImpl's isPositionToAdd method while
it checks only the parent element's equivalence, instead of checking the whole path's equivalence.
(I'm not 100% sure of that)
> Could you fix somehow the mentioned problem ? It would be very important for us and I
guess that for a lot of other people as well.
>  
> Thank you so much,
>                        have a nice day.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message