You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Daniel (Jira)" <ji...@apache.org> on 2020/05/01 10:04:00 UTC
[jira] [Updated] (JOHNZON-311) Create.diff is only fetching the
last new element
[ https://issues.apache.org/jira/browse/JOHNZON-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel updated JOHNZON-311:
---------------------------
Attachment: image-2020-05-01-11-03-25-945.png
> Create.diff is only fetching the last new element
> -------------------------------------------------
>
> Key: JOHNZON-311
> URL: https://issues.apache.org/jira/browse/JOHNZON-311
> Project: Johnzon
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.4
> Reporter: Daniel
> Assignee: Romain Manni-Bucau
> Priority: Critical
> Attachments: image-2020-04-28-19-37-14-933.png, image-2020-04-28-19-42-01-283.png, image-2020-05-01-11-03-25-945.png
>
>
> Create.diff is only fetching the last new element and ignoring the others.
> This will cause an error when applying the diference
> Ex:
> !image-2020-04-28-19-37-14-933.png!
>
> Code used:
>
> {"eventLogs": [
> {"event": "event1"}
> ]}
> {"eventLogs": [
> {"event": "event1"}
> ,\{"event": "event2"},\{"event": "event3"}]}
>
> JsonValue source = readValues("{\"eventLogs\": [
> {\"event\": \"event1\"}
> ]}");
> JsonValue target = readValues("{\"eventLogs\": [
> {\"event\": \"event1\"}
> ,\{\"event\": \"event2\"},\{\"event\": \"event3\"}]}");
> JsonPatch diff = Json.createDiff(source.asJsonObject(), target.asJsonObject());
>
> private JsonValue readValues(String valuesToRead)
> { JsonReader reader = Json.createReader(new StringReader(valuesToRead)); JsonValue value = reader.readValue(); reader.close(); return value; }
>
> Exception received
> !image-2020-04-28-19-42-01-283.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)