Skip to content

Commit b40b6b1

Browse files
committed
json_merge_patch -> mergepatch
1 parent fa73cde commit b40b6b1

File tree

9 files changed

+48
-39
lines changed

9 files changed

+48
-39
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
master
22
-----
33

4-
- Use `std::from_chars` for chars to double conversion
5-
when supported in GCC and VC.
4+
Performance Enhancement:
5+
6+
- Use `std::from_chars` for chars to double conversion when
7+
supported in GCC and VC.
8+
9+
Changes:
10+
11+
- For consistency with library naming conventions, the directory
12+
`include/jsoncons/json_merge_patch` has been renamed to
13+
`include/jsoncons/mergepatch`, and the namespace `json_merge_patch`
14+
has been renamed to `mergepatch`.
615

716
0.168.7
817
-------

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ or becoming a [:heart: sponsor](https://github.com/sponsors/danielaparker).
3636
- [csv](doc/ref/csv/csv.md) implements decode from and encode to CSV files.
3737
- [jmespath](doc/ref/jmespath/jmespath.md) implements [JMESPath](https://jmespath.org/), a query language for transforming JSON documents into other JSON documents.
3838
- [jsonpatch](doc/ref/jsonpatch/jsonpatch.md) implements the IETF standard [JavaScript Object Notation (JSON) Patch](https://tools.ietf.org/html/rfc6902)
39-
- [json_merge_patch](doc/ref/json_merge_patch/json_merge_patch.md) implements the IETF standard [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386)
39+
- [mergepatch](doc/ref/mergepatch/json_merge_patch.md) implements the IETF standard [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386)
4040
- [jsonpath](doc/ref/jsonpath/jsonpath.md) implements [Stefan Goessner's JSONPath](http://goessner.net/articles/JsonPath/). It also supports search and replace using JSONPath expressions.
4141
- [jsonpointer](doc/ref/jsonpointer/jsonpointer.md) implements the IETF standard [JavaScript Object Notation (JSON) Pointer](https://tools.ietf.org/html/rfc6901)
4242
- [jsonschema](doc/ref/jsonschema/jsonschema.md) implements the JSON Schema [Draft 7](https://json-schema.org/specification-links.html#draft-7) specification for validating input JSON. (since 0.160.0)

doc/ref/json_merge_patch/apply_merge_patch.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
### jsoncons::json_merge_patch::apply_merge_patch
1+
### jsoncons::mergepatch::apply_merge_patch
22

33
```c++
4-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
4+
#include <jsoncons_ext/mergepatch/json_merge_patch.hpp>
55

66
template <class Json>
77
void apply_merge_patch(Json& target, const Json& patch);
@@ -25,10 +25,10 @@ This example is from [RFC 7386](https://datatracker.ietf.org/doc/html/rfc7386#se
2525
2626
```c++
2727
#include <jsoncons/json.hpp>
28-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
28+
#include <jsoncons_ext/mergepatch/json_merge_patch.hpp>
2929
3030
using jsoncons::json;
31-
namespace json_merge_patch = jsoncons::json_merge_patch;
31+
namespace mergepatch = jsoncons::mergepatch;
3232
3333
int main()
3434
{
@@ -57,17 +57,17 @@ int main()
5757
}
5858
)");
5959
60-
json_merge_patch::apply_merge_patch(doc, patch);
60+
mergepatch::apply_merge_patch(doc, patch);
6161
6262
std::cout << "(1)\n" << pretty_print(doc) << std::endl;
6363
6464
// Create a JSON Patch
6565
66-
auto patch2 = json_merge_patch::from_diff(doc2,doc);
66+
auto patch2 = mergepatch::from_diff(doc2,doc);
6767
6868
std::cout << "(2)\n" << pretty_print(patch2) << std::endl;
6969
70-
json_merge_patch::apply_merge_patch(doc2,patch2);
70+
mergepatch::apply_merge_patch(doc2,patch2);
7171
7272
std::cout << "(3)\n" << pretty_print(doc2) << std::endl;
7373
}

doc/ref/json_merge_patch/from_diff.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
### jsoncons::json_merge_patch::from_diff
1+
### jsoncons::mergepatch::from_diff
22

33
```c++
4-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
4+
#include <jsoncons_ext/mergepatch/json_merge_patch.hpp>
55

66
template <class Json>
77
Json from_diff(const Json& source, const Json& target)
@@ -21,10 +21,10 @@ This example is from [RFC 7386](https://datatracker.ietf.org/doc/html/rfc7386#se
2121
2222
```c++
2323
#include <jsoncons/json.hpp>
24-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
24+
#include <jsoncons_ext/mergepatch/json_merge_patch.hpp>
2525
2626
using jsoncons::json;
27-
namespace json_merge_patch = jsoncons::json_merge_patch;
27+
namespace mergepatch = jsoncons::mergepatch;
2828
2929
int main()
3030
{
@@ -54,9 +54,9 @@ int main()
5454
}
5555
)");
5656
57-
auto patch = json_merge_patch::from_diff(source, target);
57+
auto patch = mergepatch::from_diff(source, target);
5858
59-
json_merge_patch::apply_merge_patch(source, patch);
59+
mergepatch::apply_merge_patch(source, patch);
6060
6161
std::cout << "(1)\n" << pretty_print(patch) << std::endl;
6262
std::cout << "(2)\n" << pretty_print(source) << std::endl;

doc/ref/json_merge_patch/json_merge_patch.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
### json_merge_patch extension
1+
### mergepatch extension
22

3-
The json_merge_patch extension implements the IETF standard [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386)
3+
The mergepatch extension implements the IETF standard [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386)
44

55
<table border="0">
66
<tr>
@@ -19,10 +19,10 @@ This example is from [RFC 7386](https://datatracker.ietf.org/doc/html/rfc7386#se
1919

2020
```c++
2121
#include <jsoncons/json.hpp>
22-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
22+
#include <jsoncons_ext/mergepatch/json_merge_patch.hpp>
2323

2424
using jsoncons::json;
25-
namespace json_merge_patch = jsoncons::json_merge_patch;
25+
namespace mergepatch = jsoncons::mergepatch;
2626

2727
int main()
2828
{
@@ -51,17 +51,17 @@ int main()
5151
}
5252
)");
5353
54-
json_merge_patch::apply_merge_patch(doc, patch);
54+
mergepatch::apply_merge_patch(doc, patch);
5555
5656
std::cout << "(1)\n" << pretty_print(doc) << std::endl;
5757
5858
// Create a JSON Patch
5959
60-
auto patch2 = json_merge_patch::from_diff(doc2,doc);
60+
auto patch2 = mergepatch::from_diff(doc2,doc);
6161
6262
std::cout << "(2)\n" << pretty_print(patch2) << std::endl;
6363
64-
json_merge_patch::apply_merge_patch(doc2,patch2);
64+
mergepatch::apply_merge_patch(doc2,patch2);
6565
6666
std::cout << "(3)\n" << pretty_print(doc2) << std::endl;
6767
}

examples/src/json_merge_patch_examples.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// Distributed under Boost license
33

44
#include <jsoncons/json.hpp>
5-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
5+
#include <jsoncons_ext/mergepatch/mergepatch.hpp>
66

77
using jsoncons::json;
8-
namespace json_merge_patch = jsoncons::json_merge_patch;
8+
namespace mergepatch = jsoncons::mergepatch;
99

1010
void apply_json_merge_patch()
1111
{
@@ -36,17 +36,17 @@ void apply_json_merge_patch()
3636
}
3737
)");
3838

39-
json_merge_patch::apply_merge_patch(doc, patch);
39+
mergepatch::apply_merge_patch(doc, patch);
4040

4141
std::cout << "(1)\n" << pretty_print(doc) << std::endl;
4242

4343
// Create a JSON Patch
4444

45-
auto patch2 = json_merge_patch::from_diff(doc2,doc);
45+
auto patch2 = mergepatch::from_diff(doc2,doc);
4646

4747
std::cout << "(2)\n" << pretty_print(patch2) << std::endl;
4848

49-
json_merge_patch::apply_merge_patch(doc2,patch2);
49+
mergepatch::apply_merge_patch(doc2,patch2);
5050

5151
std::cout << "(3)\n" << pretty_print(doc2) << std::endl;
5252
}
@@ -79,9 +79,9 @@ void create_json_merge_patch()
7979
}
8080
)");
8181

82-
auto patch = json_merge_patch::from_diff(source, target);
82+
auto patch = mergepatch::from_diff(source, target);
8383

84-
json_merge_patch::apply_merge_patch(source, patch);
84+
mergepatch::apply_merge_patch(source, patch);
8585

8686
std::cout << "(1)\n" << pretty_print(patch) << std::endl;
8787
std::cout << "(2)\n" << pretty_print(source) << std::endl;

include/jsoncons_ext/json_merge_patch/json_merge_patch.hpp renamed to include/jsoncons_ext/mergepatch/json_merge_patch.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <jsoncons/json.hpp>
1616

1717
namespace jsoncons {
18-
namespace json_merge_patch {
18+
namespace mergepatch {
1919

2020
template <class Json>
2121
Json from_diff(const Json& source, const Json& target)
@@ -97,7 +97,7 @@ namespace json_merge_patch {
9797
target = detail::apply_merge_patch_(target, patch);
9898
}
9999

100-
} // namespace json_merge_patch
100+
} // namespace mergepatch
101101
} // namespace jsoncons
102102

103103
#endif

test/json_merge_patch/src/json_merge_patch_test_suite.cpp renamed to test/mergepatch/src/json_merge_patch_test_suite.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#endif
77
#include <iostream>
88
#include <jsoncons/json.hpp>
9-
#include <jsoncons_ext/json_merge_patch/json_merge_patch.hpp>
9+
#include <jsoncons_ext/mergepatch/json_merge_patch.hpp>
1010
#include <catch/catch.hpp>
1111
#include <iostream>
1212
#include <sstream>
@@ -38,13 +38,13 @@ void json_merge_patch_tests(const std::string& fpath)
3838
if (test_case.contains("result"))
3939
{
4040
json target = test_group.at("given");
41-
json_merge_patch::apply_merge_patch(target, patch);
41+
mergepatch::apply_merge_patch(target, patch);
4242
const json& expected = test_case["result"];
4343
if (target == expected)
4444
{
4545
json target2 = test_group.at("given");
46-
json patch2 = json_merge_patch::from_diff(target2, target);
47-
json_merge_patch::apply_merge_patch(target2, patch2);
46+
json patch2 = mergepatch::from_diff(target2, target);
47+
mergepatch::apply_merge_patch(target2, patch2);
4848
if (target2 != target)
4949
{
5050
if (test_case.contains("comment"))
@@ -75,12 +75,12 @@ void json_merge_patch_tests(const std::string& fpath)
7575
}
7676
}
7777

78-
TEST_CASE("json_merge_patch tests")
78+
TEST_CASE("mergepatch tests")
7979
{
8080
SECTION("compliance")
8181
{
82-
json_merge_patch_tests("./json_merge_patch/input/compliance/rfc7396-test-cases.json");
83-
//json_merge_patch_tests("./json_merge_patch/input/compliance/test.json");
82+
json_merge_patch_tests("./mergepatch/input/compliance/rfc7396-test-cases.json");
83+
//json_merge_patch_tests("./mergepatch/input/compliance/test.json");
8484
}
8585
}
8686

0 commit comments

Comments
 (0)