Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-10-18 Thread via GitHub


bytelazy closed pull request #12391: fix(grpc-transcode): correctly serialize 
empty repeated fields to []
URL: https://github.com/apache/apisix/pull/12391


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-10-17 Thread via GitHub


bytelazy commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3368399351

   hi @Baoyuantop 
   Thanks for your review and patience!
   Due to a history rewrite (to fix author info), the previous branch was 
force-pushed and this PR was automatically closed by GitHub.
   I've recreated the same change in a new PR here: 
[#NEW_PR_NUMBER](https://github.com/apache/apisix/pull/12649)
   
   Sorry for the inconvenience, and please continue the review there 🙏


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-24 Thread via GitHub


bytelazy commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3332443041

   > Hi @bytelazy, some failed tests need to be fixed.
   
   Got it. I'll fix the failed tests soon.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-14 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3290573753

   Hi @bytelazy, some failed tests need to be fixed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-12 Thread via GitHub


bytelazy commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3284352731

   > Hi @bytelazy, could you please merge the latest master branch code?
   
   sure, I have merged the latest master branch


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-08 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3268768050

   Hi @bytelazy, could you please merge the latest master branch code?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-07 Thread via GitHub


bytelazy commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3263893112

   > Hi @bytelazy, any updates?
   @Baoyuantop 
   Upon examination, I found that a manual update to the code was necessary. 
What else do I need to do next
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-07 Thread via GitHub


bytelazy commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2328757087


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,48 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+if proto_obj["name"] then
+names[proto_obj["name"]] = 1
+end
+end
+end
+return names
+end
+
+local function set_default_array(tab, array_names)
+if type(tab) ~= "table" then
+return
+end
+for k, v in pairs(tab) do
+if type(v) == "table" then
+if array_names[k] == 1 then
+setmetatable(v, core.json.array_mt)
+end
+set_default_array(v, array_names)
+end
+end
+end

Review Comment:
   hi @nic-6443 
   In APISIX, empty repeated fields are decoded by lua-protobuf as plain Lua 
tables ({}). By default, cjson encodes an empty table as {} rather than [].
   
   pb.option("decode_default_array") ensures the field is always a table, but 
it does not mark it as an array for JSON encoding.
   
   Only tables with cjson.empty_array_mt (or core.json.array_mt) serialize as 
[].
   
   There’s no way to make empty repeated fields encode as [] purely via 
lua-protobuf configuration. Handling this in response.lua (setting array_mt) is 
the reliable solution with the current APISIX setup.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-07 Thread via GitHub


bytelazy commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3263842841

   > Hi @bytelazy, any updates?
   hi @Baoyuantop , I'm sorry I've been a bit busy lately, but I'm currently 
testing to add only parse parameters, so please give me more time


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-09-04 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3252334856

   Hi @bytelazy, any updates?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-08-16 Thread via GitHub


bytelazy commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2280251407


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,48 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+if proto_obj["name"] then
+names[proto_obj["name"]] = 1
+end
+end
+end
+return names
+end
+
+local function set_default_array(tab, array_names)
+if type(tab) ~= "table" then
+return
+end
+for k, v in pairs(tab) do
+if type(v) == "table" then
+if array_names[k] == 1 then
+setmetatable(v, core.json.array_mt)
+end
+set_default_array(v, array_names)
+end
+end
+end

Review Comment:
   > please check 
[starwing/lua-protobuf#240](https://github.com/starwing/lua-protobuf/pull/240), 
I think we don't need to deal with this issue manually.
   
   I understand, you're saying that it's better to meet the requirements with 
simple options rather than making extensive code changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-08-15 Thread via GitHub


bytelazy commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2280253020


##
t/plugin/grpc-transcode4.t:
##
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+# ensure that the JSON module of Perl is installed in your test environment.
+# If it is not installed, sudo cpanm JSON.
+use JSON;
+
+no_long_string();
+no_shuffle();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: set rule
+--- config
+location /t {
+   content_by_lua_block {
+  local http = require "resty.http"
+  local t = require("lib.test_admin").test
+  local code, body = t('/apisix/admin/protos/1',
+ngx.HTTP_PUT,
+[[{
+   "content" : "syntax = \"proto3\";
+package user;
+service UserService {
+rpc GetUserInfo(UserRequest) returns (UserResponse) {}
+ }
+
+enum Gender {
+GENDER_UNSPECIFIED = 0;
+GENDER_MALE = 1;
+GENDER_FEMALE = 2;
+}
+message Job {
+string items = 1;
+}
+message UserRequest {
+string name = 1;
+int32 age = 2;
+}
+
+message UserResponse {
+Gender gender = 1;
+repeated string items = 2;
+string message = 3;
+Job job = 4;
+}"
+}]]
+  )
+
+ if code >= 300 then
+ ngx.say(body)
+ return
+  end
+
+ local code, body = t('/apisix/admin/routes/1',
+ngx.HTTP_PUT,
+[[{
+   "methods": ["POST"],
+"uri": "/grpctest",
+"plugins": {
+"grpc-transcode": {
+"proto_id": "1",
+"service": "user.UserService",
+"method": "GetUserInfo"
+   }
+},
+"upstream": {
+"scheme": "grpc",
+"type": "roundrobin",
+"nodes": {
+"127.0.0.1:50051": 1

Review Comment:
   When running tests, I used a custom grpc server instead of the original grpc 
server in apisix. Should I merge the master branch into my local deveop branch?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-08-15 Thread via GitHub


bytelazy commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2278721055


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,48 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+if proto_obj["name"] then
+names[proto_obj["name"]] = 1
+end
+end
+end
+return names
+end
+
+local function set_default_array(tab, array_names)
+if type(tab) ~= "table" then
+return
+end
+for k, v in pairs(tab) do
+if type(v) == "table" then
+if array_names[k] == 1 then
+setmetatable(v, core.json.array_mt)
+end
+set_default_array(v, array_names)
+end
+end
+end

Review Comment:
   In https://github.com/starwing/lua-protobuf/pull/240 , the author said that 
this change will go online in the new version, but the latest version does not 
directly deal with the problem of empty arrays.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-08-15 Thread via GitHub


bytelazy commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3191140317

   > Hi @bytelazy, there are still some review comments that need to be 
addressed.
   
   thanks for reminding me, I have checked the comment and reply


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-08-15 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3191093875

   Hi @bytelazy, there are still some review comments that need to be addressed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244259216


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,48 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+if proto_obj["name"] then
+names[proto_obj["name"]] = 1
+end
+end
+end
+return names
+end
+
+local function set_default_array(tab, array_names)
+if type(tab) ~= "table" then
+return
+end
+for k, v in pairs(tab) do
+if type(v) == "table" then
+if array_names[k] == 1 then
+setmetatable(v, core.json.array_mt)
+end
+set_default_array(v, array_names)
+end
+end
+end

Review Comment:
   please check https://github.com/starwing/lua-protobuf/pull/240, I think we 
don't need to deal with this issue manually.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244240301


##
t/plugin/grpc-transcode4.t:
##
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+# ensure that the JSON module of Perl is installed in your test environment.
+# If it is not installed, sudo cpanm JSON.
+use JSON;
+
+no_long_string();
+no_shuffle();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: set rule
+--- config
+location /t {
+   content_by_lua_block {
+  local http = require "resty.http"
+  local t = require("lib.test_admin").test
+  local code, body = t('/apisix/admin/protos/1',
+ngx.HTTP_PUT,
+[[{
+   "content" : "syntax = \"proto3\";
+package user;
+service UserService {
+rpc GetUserInfo(UserRequest) returns (UserResponse) {}
+ }
+
+enum Gender {
+GENDER_UNSPECIFIED = 0;
+GENDER_MALE = 1;
+GENDER_FEMALE = 2;
+}
+message Job {
+string items = 1;
+}
+message UserRequest {
+string name = 1;
+int32 age = 2;
+}
+
+message UserResponse {
+Gender gender = 1;
+repeated string items = 2;
+string message = 3;
+Job job = 4;
+}"
+}]]
+  )
+
+ if code >= 300 then
+ ngx.say(body)
+ return
+  end
+
+ local code, body = t('/apisix/admin/routes/1',
+ngx.HTTP_PUT,
+[[{
+   "methods": ["POST"],
+"uri": "/grpctest",
+"plugins": {
+"grpc-transcode": {
+"proto_id": "1",
+"service": "user.UserService",
+"method": "GetUserInfo"
+   }
+},
+"upstream": {
+"scheme": "grpc",
+"type": "roundrobin",
+"nodes": {
+"127.0.0.1:50051": 1

Review Comment:
   I can't found this test backend in APISIX e2e framework, I think this new 
added test cased can't be pass due to 
https://github.com/apache/apisix/pull/12462  ,  try to merge master branch and 
re-run CI again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244192410


##
t/plugin/grpc-transcode4.t:
##
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+# ensure that the JSON module of Perl is installed in your test environment.
+# If it is not installed, sudo cpanm JSON.
+use JSON;
+
+no_long_string();
+no_shuffle();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: set rule
+--- config
+location /t {
+   content_by_lua_block {
+  local http = require "resty.http"
+  local t = require("lib.test_admin").test
+  local code, body = t('/apisix/admin/protos/1',
+ngx.HTTP_PUT,
+[[{
+   "content" : "syntax = \"proto3\";
+package user;
+service UserService {
+rpc GetUserInfo(UserRequest) returns (UserResponse) {}
+ }
+
+enum Gender {
+GENDER_UNSPECIFIED = 0;
+GENDER_MALE = 1;
+GENDER_FEMALE = 2;
+}
+message Job {
+string items = 1;

Review Comment:
   I understood now, you want to verify that the `fetch_proto_array_names` 
function can handle scenarios with fields of the same name at different levels.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244192410


##
t/plugin/grpc-transcode4.t:
##
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+# ensure that the JSON module of Perl is installed in your test environment.
+# If it is not installed, sudo cpanm JSON.
+use JSON;
+
+no_long_string();
+no_shuffle();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: set rule
+--- config
+location /t {
+   content_by_lua_block {
+  local http = require "resty.http"
+  local t = require("lib.test_admin").test
+  local code, body = t('/apisix/admin/protos/1',
+ngx.HTTP_PUT,
+[[{
+   "content" : "syntax = \"proto3\";
+package user;
+service UserService {
+rpc GetUserInfo(UserRequest) returns (UserResponse) {}
+ }
+
+enum Gender {
+GENDER_UNSPECIFIED = 0;
+GENDER_MALE = 1;
+GENDER_FEMALE = 2;
+}
+message Job {
+string items = 1;

Review Comment:
   I understand, you want to verify that the `fetch_proto_array_names` function 
can handle scenarios with fields of the same name at different levels.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244190888


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,48 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do

Review Comment:
   ```suggestion
   for k, v in pairs(proto_obj) do
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244188187


##
t/plugin/grpc-transcode4.t:
##
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+# ensure that the JSON module of Perl is installed in your test environment.
+# If it is not installed, sudo cpanm JSON.
+use JSON;
+
+no_long_string();
+no_shuffle();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: set rule
+--- config
+location /t {
+   content_by_lua_block {
+  local http = require "resty.http"
+  local t = require("lib.test_admin").test
+  local code, body = t('/apisix/admin/protos/1',
+ngx.HTTP_PUT,
+[[{
+   "content" : "syntax = \"proto3\";
+package user;
+service UserService {
+rpc GetUserInfo(UserRequest) returns (UserResponse) {}
+ }
+
+enum Gender {
+GENDER_UNSPECIFIED = 0;
+GENDER_MALE = 1;
+GENDER_FEMALE = 2;
+}
+message Job {
+string items = 1;

Review Comment:
   ```suggestion
   string name = 1;
   ```
   this naming make me confused with `UserResponse.items` in test cases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-30 Thread via GitHub


nic-6443 commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2244188187


##
t/plugin/grpc-transcode4.t:
##
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+# ensure that the JSON module of Perl is installed in your test environment.
+# If it is not installed, sudo cpanm JSON.
+use JSON;
+
+no_long_string();
+no_shuffle();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: set rule
+--- config
+location /t {
+   content_by_lua_block {
+  local http = require "resty.http"
+  local t = require("lib.test_admin").test
+  local code, body = t('/apisix/admin/protos/1',
+ngx.HTTP_PUT,
+[[{
+   "content" : "syntax = \"proto3\";
+package user;
+service UserService {
+rpc GetUserInfo(UserRequest) returns (UserResponse) {}
+ }
+
+enum Gender {
+GENDER_UNSPECIFIED = 0;
+GENDER_MALE = 1;
+GENDER_FEMALE = 2;
+}
+message Job {
+string items = 1;

Review Comment:
   ```suggestion
   string name = 1;
   ```
   this naming make me confused with `UserResponse.items` in following 
`response_body_json` assert.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-23 Thread via GitHub


3kis commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2225117017


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,46 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]] = 1

Review Comment:
   done. pls approve again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-22 Thread via GitHub


Baoyuantop commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2224137887


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,46 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]] = 1

Review Comment:
   Check if proto_obj.name exists before accessing it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-21 Thread via GitHub


Copilot commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2218734644


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3

Review Comment:
   The magic number '3' should be replaced with a named constant or documented 
with a comment explaining that this represents the protobuf repeated field 
label value.
   ```suggestion
   -- Protobuf repeated field label value
   local PROTOBUF_REPEATED_LABEL = 3
   local repeated_label = PROTOBUF_REPEATED_LABEL
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs(sub_names) do
+names[sub_name] = 1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]] = 1
+end
+end
+return names
+end
+
+local function set_default_array(tab, array_names)
+if type(tab) ~= "table" then
+return false

Review Comment:
   The function returns 'false' for non-table inputs but this return value is 
never used by callers. Consider removing the return statement or making the 
function return void.
   ```suggestion
   return
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-21 Thread via GitHub


Copilot commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2218658771


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs (sub_names ) do
+names[sub_name]=1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]]=1

Review Comment:
   [nitpick] Missing spaces around assignment operator. Should be 
'names[proto_obj["name"]] = 1' for consistency.
   ```suggestion
   names[proto_obj["name"]] = 1
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs (sub_names ) do

Review Comment:
   Extra spaces around parentheses. Should be 'pairs(sub_names)' instead of 
'pairs (sub_names )'.
   ```suggestion
   for sub_name,_ in pairs(sub_names) do
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs (sub_names ) do
+names[sub_name]=1

Review Comment:
   [nitpick] Missing spaces around assignment operator. Should be 
'names[sub_name] = 1' for consistency with line 45.
   ```suggestion
   names[sub_name] = 1
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs (sub_names ) do
+names[sub_name]=1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]]=1
+end
+end
+return names
+end
+
+local function set_default_array(tab, array_names)
+if type(tab) ~= "table" then
+return false
+end
+for k, v in pairs(tab) do
+if type(v) == "table" then
+if array_names[k] == 1 then
+setmetatable(v,core.json.array_mt)

Review Comment:
   [nitpick] Missing space after comma. Should be 'setmetatable(v, 
core.json.array_mt)' for consistency with Lua style conventions.
   ```suggestion
   setmetatable(v, core.json.array_mt)
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -23,6 +23,44 @@ local string = string
 local ngx_decode_base64 = ngx.decode_base64
 local ipairs = ipairs
 local pcall  = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pai

Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-15 Thread via GitHub


3kis commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3073753903

   > There are many spaces used incorrectly, please check carefully.
   
   Thanks your suggestions, I have reverted to additional modifications


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-14 Thread via GitHub


Baoyuantop commented on code in PR #12391:
URL: https://github.com/apache/apisix/pull/12391#discussion_r2206501304


##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -132,6 +170,9 @@ return function(ctx, proto, service, method, pb_option, 
show_status_in_body, sta
 return err_msg
 end
 
+local array_names = fetch_proto_array_names ( proto )

Review Comment:
   ```suggestion
   local array_names = fetch_proto_array_names( proto )
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -132,6 +170,9 @@ return function(ctx, proto, service, method, pb_option, 
show_status_in_body, sta
 return err_msg
 end
 
+local array_names = fetch_proto_array_names ( proto )
+set_default_array(decoded,array_names)

Review Comment:
   ```suggestion
   set_default_array(decoded, array_names)
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -16,13 +16,51 @@
 --
 local util= require("apisix.plugins.grpc-transcode.util")
 local grpc_proto  = require("apisix.plugins.grpc-transcode.proto")
-local core   = require("apisix.core")
-local pb = require("pb")
-local ngx= ngx
-local string = string
+local core= require("apisix.core")
+local pb  = require("pb")
+local ngx = ngx
+local string  = string
 local ngx_decode_base64 = ngx.decode_base64
-local ipairs = ipairs
-local pcall  = pcall
+local ipairs  = ipairs
+local pcall   = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs (sub_names ) do
+names[sub_name]=1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]]=1
+end
+end
+return names
+end
+
+local function set_default_array(tab,array_names )

Review Comment:
   ```suggestion
   local function set_default_array(tab, array_names)
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -16,13 +16,51 @@
 --
 local util= require("apisix.plugins.grpc-transcode.util")
 local grpc_proto  = require("apisix.plugins.grpc-transcode.proto")
-local core   = require("apisix.core")
-local pb = require("pb")
-local ngx= ngx
-local string = string
+local core= require("apisix.core")
+local pb  = require("pb")
+local ngx = ngx
+local string  = string
 local ngx_decode_base64 = ngx.decode_base64
-local ipairs = ipairs
-local pcall  = pcall
+local ipairs  = ipairs
+local pcall   = pcall
+local type  = type
+local pairs = pairs
+local setmetatable  = setmetatable
+
+pb.option "decode_default_array"
+local repeated_label = 3
+
+local function fetch_proto_array_names(proto_obj)
+local names = {}
+if type(proto_obj) == "table" then
+for k,v in pairs(proto_obj) do
+if type(v) == "table" then
+local sub_names = fetch_proto_array_names(v)
+for sub_name,_ in pairs (sub_names ) do
+names[sub_name]=1
+end
+end
+end
+if proto_obj["label"] == repeated_label then
+names[proto_obj["name"]]=1
+end
+end
+return names
+end
+
+local function set_default_array(tab,array_names )
+if type(tab) ~= "table" then
+return false
+end
+for k, v  in pairs(tab) do

Review Comment:
   ```suggestion
   for k, v in pairs(tab) do
   ```



##
apisix/plugins/grpc-transcode/response.lua:
##
@@ -6,7 +6,7 @@
 -- (the "License"); you may not use this file except in compliance with
 -- the License.  You may obtain a copy of the License at
 --
--- http://www.apache.org/licenses/LICENSE-2.0
+--  http://www.apache.org/licenses/LICENSE-2.0

Review Comment:
   Please revert these additional changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-13 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3067020210

   CI has all passed, the error has nothing to do with this PR, I will review 
this PR as soon as possible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-11 Thread via GitHub


3kis commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3062077971

   > Hi @3kis, please fix lint error.
   
   hi~ I have fixed lint error. What should I do next?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-10 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3060757612

   Hi @3kis, please fix lint error.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-04 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3034817840

   > I need to download Golang in the dev container and run 
/grpc_server_example/main.go?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-02 Thread via GitHub


3kis commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3031043239

   > > > Thank you for your contribution!
   > > > Two things need to be done:
   > > > 
   > > > 1. Need to add corresponding tests for this fix, please feel free to 
ask questions if you encounter any problems.
   > > > 2. Need to pass all CI.
   > > 
   > > 
   > > All CI have passed. Under which directory should I add the corresponding 
tests for this fix ?
   > 
   > Add test case for grpc-transcode plugin in t/plugin/grpc-transcode.t
   
   Based on the documentation you provided, after running prove -I. 
-I../test-nginx/inc -I../test-nginx/lib -r t/plugin/grpc-transcode.t, I 
encountered connect() failed (111: Connection refused) while connecting to 
upstream, client: 127.0.0.1.
   
   Upon observation, I noticed that the /t directory contains a 
/grpc_server_example directory. Does this mean that to test 
t/plugin/grpc-transcode.t, I need to download Golang in the dev container and 
run /grpc_server_example/main.go?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-02 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3030140934

   Hi @3kis, you can refer to 
https://github.com/apache/apisix/blob/master/docs/en/latest/build-apisix-dev-environment-devcontainers.md
 and https://apisix.apache.org/docs/apisix/internal/testing-framework/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-02 Thread via GitHub


3kis commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3028011861

   > > > Thank you for your contribution!
   > > > Two things need to be done:
   > > > 
   > > > 1. Need to add corresponding tests for this fix, please feel free to 
ask questions if you encounter any problems.
   > > > 2. Need to pass all CI.
   > > 
   > > 
   > > All CI have passed. Under which directory should I add the corresponding 
tests for this fix ?
   > 
   > Add test case for grpc-transcode plugin in t/plugin/grpc-transcode.t
   
   I don't know how to run the test file. Can you give me some reference 
documents?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-02 Thread via GitHub


Baoyuantop commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3027158644

   > > Thank you for your contribution!
   > > Two things need to be done:
   > > 
   > > 1. Need to add corresponding tests for this fix, please feel free to ask 
questions if you encounter any problems.
   > > 2. Need to pass all CI.
   > 
   > All CI have passed. Under which directory should I add the corresponding 
tests for this fix ?
   
   Add test case for grpc-transcode plugin in t/plugin/grpc-transcode.t


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(grpc-transcode): correctly serialize empty repeated fields to [] [apisix]

2025-07-02 Thread via GitHub


3kis commented on PR #12391:
URL: https://github.com/apache/apisix/pull/12391#issuecomment-3026861541

   > Thank you for your contribution!
   > 
   > Two things need to be done:
   > 
   > 1. Need to add corresponding tests for this fix, please feel free to ask 
questions if you encounter any problems.
   > 2. Need to pass all CI.
   
   All CI have passed.
   Under which directory should I add the corresponding tests  for this fix ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]