Skip to content

Commit 6af384e

Browse files
yuval-ksoloio-bulldozer[bot]
authored andcommitted
update json (#20)
* update json * inja * include prefix * inj * injase * inja * doci * no consul * dont run coverage
1 parent e4e05ca commit 6af384e

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

bazel/external/inja.BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cc_library(
22
name = "inja-lib",
3-
hdrs = ["src/inja.hpp"],
3+
hdrs = ["single_include/inja/inja.hpp"],
44
visibility = ["//visibility:public"],
5-
strip_include_prefix = "src/",
5+
strip_include_prefix = "single_include/",
66
)

bazel/external/json.BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ cc_library(
22
name = "json-lib",
33
hdrs = ["single_include/nlohmann/json.hpp"],
44
visibility = ["//visibility:public"],
5-
strip_include_prefix = "single_include/nlohmann/",
5+
strip_include_prefix = "single_include/",
66
)

bazel/repository_locations.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ REPOSITORY_LOCATIONS = dict(
44
remote = "https://github.com/envoyproxy/envoy",
55
),
66
inja = dict(
7-
commit = "74ad4281edd4ceca658888602af74bf2050107f0",
7+
commit = "4c0ee3a46c0bbb279b0849e5a659e52684a37a98",
88
remote = "https://github.com/pantor/inja",
99
),
1010
json = dict(
11-
commit = "d2dd27dc3b8472dbaa7d66f83619b3ebcd9185fe", # v3.1.2
11+
commit = "53c3eefa2cf790a7130fed3e13a3be35c2f2ace2", # v3.7.0
1212
remote = "https://github.com/nlohmann/json",
1313
),
1414
)

ci/do_ci.sh

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ case "$1" in
108108
;;
109109
"test")
110110
bazel test ${BAZEL_BUILD_OPTIONS} -c opt //test/extensions/...
111+
bazel test ${BAZEL_BUILD_OPTIONS} -c opt //test/integration/...
112+
bazel test ${BAZEL_BUILD_OPTIONS} -c opt //test/common/...
111113
# bazel build ${BAZEL_BUILD_OPTIONS} -c opt //test/...
112114
# bazel test ${BAZEL_BUILD_OPTIONS} -c opt //test/...
113115
;;

source/extensions/filters/http/transformation/body_header_transformer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "envoy/buffer/buffer.h"
66
#include "envoy/http/header_map.h"
77

8-
#include "json.hpp"
8+
#include "nlohmann/json.hpp"
99

1010
namespace Envoy {
1111
namespace Extensions {

source/extensions/filters/http/transformation/transformer.cc

+10-9
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ TransformerInstance::TransformerInstance(
6868
const std::map<std::string, std::string> &extractions, const json &context)
6969
: header_map_(header_map), extractions_(extractions), context_(context) {
7070
env_.add_callback(
71-
"header", 1,
72-
std::bind(&TransformerInstance::header_callback, this, _1, _2));
71+
"header", 1, [this](Arguments args) {
72+
return header_callback(args);
73+
});
7374
env_.add_callback(
74-
"extraction", 1,
75-
std::bind(&TransformerInstance::extracted_callback, this, _1, _2));
75+
"extraction", 1, [this](Arguments args) {
76+
return extracted_callback(args);
77+
});
7678
}
7779

78-
json TransformerInstance::header_callback(Parsed::Arguments args, json data) {
79-
std::string headername = env_.get_argument<std::string>(args, 0, data);
80+
json TransformerInstance::header_callback(Arguments args) {
81+
std::string headername = args.at(0)->get<std::string>();
8082
const Http::HeaderEntry *header_entry =
8183
getHeader(header_map_, std::move(headername));
8284
if (!header_entry) {
@@ -85,9 +87,8 @@ json TransformerInstance::header_callback(Parsed::Arguments args, json data) {
8587
return std::string(header_entry->value().getStringView());
8688
}
8789

88-
json TransformerInstance::extracted_callback(Parsed::Arguments args,
89-
json data) {
90-
std::string name = env_.get_argument<std::string>(args, 0, data);
90+
json TransformerInstance::extracted_callback(Arguments args) {
91+
std::string name = args.at(0)->get<std::string>();
9192
const auto value_it = extractions_.find(name);
9293
if (value_it != extractions_.end()) {
9394
return value_it->second;

source/extensions/filters/http/transformation/transformer.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include "envoy/http/header_map.h"
77

88
// clang-format off
9-
#include "json.hpp"
10-
#include "inja.hpp"
9+
#include "nlohmann/json.hpp"
10+
#include "inja/inja.hpp"
1111
// clang-format on
1212

1313
#include "api/envoy/config/filter/http/transformation/v2/transformation_filter.pb.validate.h"
@@ -31,11 +31,9 @@ class TransformerInstance {
3131
const nlohmann::json &context);
3232
// header_value(name)
3333
// extracted_value(name, index)
34-
nlohmann::json header_callback(inja::Parsed::Arguments args,
35-
nlohmann::json data);
34+
nlohmann::json header_callback(inja::Arguments args);
3635

37-
nlohmann::json extracted_callback(inja::Parsed::Arguments args,
38-
nlohmann::json data);
36+
nlohmann::json extracted_callback(inja::Arguments args);
3937

4038
std::string render(const std::string &input);
4139

test/coverage/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ envoy_gloo_cc_test(
4242
"//test/extensions/filters/http/transformation:body_header_transformer_test_lib_internal_only",
4343
"//test/extensions/filters/http/transformation:transformation_filter_test_lib_internal_only",
4444
"//test/extensions/filters/http/transformation:transformer_test_lib_internal_only",
45-
"//test/extensions/filters/network/consul_connect:consul_connect_test_lib_internal_only",
4645
"//test/integration:aws_lambda_filter_integration_test_lib_internal_only",
4746
"//test/integration:transformation_filter_integration_test_lib_internal_only",
4847
],

0 commit comments

Comments
 (0)