Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
dd04a329
Unverified
Commit
dd04a329
authored
Apr 13, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
fix bug in diff function #1983
parent
b7be613b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
json.hpp
include/nlohmann/json.hpp
+1
-1
json.hpp
single_include/nlohmann/json.hpp
+1
-1
unit-regression.cpp
test/src/unit-regression.cpp
+8
-0
No files found.
include/nlohmann/json.hpp
View file @
dd04a329
...
@@ -7930,7 +7930,7 @@ class basic_json
...
@@ -7930,7 +7930,7 @@ class basic_json
result
.
push_back
(
result
.
push_back
(
{
{
{
"op"
,
"add"
},
{
"op"
,
"add"
},
{
"path"
,
path
+
"/
"
+
std
::
to_string
(
i
)
},
{
"path"
,
path
+
"/
-"
},
{
"value"
,
target
[
i
]}
{
"value"
,
target
[
i
]}
});
});
++
i
;
++
i
;
...
...
single_include/nlohmann/json.hpp
View file @
dd04a329
...
@@ -22741,7 +22741,7 @@ class basic_json
...
@@ -22741,7 +22741,7 @@ class basic_json
result
.
push_back
(
result
.
push_back
(
{
{
{
"op"
,
"add"
},
{
"op"
,
"add"
},
{
"path"
,
path
+
"/
"
+
std
::
to_string
(
i
)
},
{
"path"
,
path
+
"/
-"
},
{
"value"
,
target
[
i
]}
{
"value"
,
target
[
i
]}
});
});
++
i
;
++
i
;
...
...
test/src/unit-regression.cpp
View file @
dd04a329
...
@@ -1896,6 +1896,14 @@ TEST_CASE("regression tests")
...
@@ -1896,6 +1896,14 @@ TEST_CASE("regression tests")
static_assert
(
!
std
::
is_constructible
<
json
,
std
::
tuple
<
NotSerializableData
,
std
::
string
>>::
value
,
""
);
static_assert
(
!
std
::
is_constructible
<
json
,
std
::
tuple
<
NotSerializableData
,
std
::
string
>>::
value
,
""
);
static_assert
(
std
::
is_constructible
<
json
,
std
::
tuple
<
int
,
std
::
string
>>::
value
,
""
);
static_assert
(
std
::
is_constructible
<
json
,
std
::
tuple
<
int
,
std
::
string
>>::
value
,
""
);
}
}
SECTION
(
"issue #1983 - JSON patch diff for op=add formation is not as per standard (RFC 6902)"
)
{
const
auto
source
=
R"({ "foo": [ "1", "2" ] })"
_json
;
const
auto
target
=
R"({"foo": [ "1", "2", "3" ]})"
_json
;
const
auto
result
=
json
::
diff
(
source
,
target
);
CHECK
(
result
.
dump
()
==
R"([{"op":"add","path":"/foo/-","value":"3"}])"
);
}
}
}
#if not defined(JSON_NOEXCEPTION)
#if not defined(JSON_NOEXCEPTION)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment