You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/09 02:12:29 UTC

[GitHub] [apisix] tzssangglass opened a new pull request, #7630: change: adjust response format for V3 feature

tzssangglass opened a new pull request, #7630:
URL: https://github.com/apache/apisix/pull/7630

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes #7320
   
   It is sister PR of #7366
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander merged pull request #7630: change: adjust response format for V3 feature

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #7630:
URL: https://github.com/apache/apisix/pull/7630


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7630: change: adjust response format for V3 feature

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7630:
URL: https://github.com/apache/apisix/pull/7630#discussion_r942142362


##########
apisix/core/config_etcd.lua:
##########
@@ -212,14 +212,15 @@ local function load_full_data(self, dir_res, headers)
         self:upgrade_version(item.modifiedIndex)
 
     else
-        if not dir_res.nodes then
-            dir_res.nodes = {}
+        local values = (dir_res and dir_res.nodes) or dir_res

Review Comment:
   add



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on a diff in pull request #7630: change: adjust response format for V3 feature

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7630:
URL: https://github.com/apache/apisix/pull/7630#discussion_r942044257


##########
apisix/core/config_etcd.lua:
##########
@@ -212,14 +212,15 @@ local function load_full_data(self, dir_res, headers)
         self:upgrade_version(item.modifiedIndex)
 
     else
-        if not dir_res.nodes then
-            dir_res.nodes = {}
+        local values = (dir_res and dir_res.nodes) or dir_res

Review Comment:
   Is `or dir_res` useful?
   If dir_res is nil, we don't need `or dir_res`.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7630: change: adjust response format for V3 feature

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7630:
URL: https://github.com/apache/apisix/pull/7630#discussion_r942070069


##########
apisix/core/config_etcd.lua:
##########
@@ -212,14 +212,15 @@ local function load_full_data(self, dir_res, headers)
         self:upgrade_version(item.modifiedIndex)
 
     else
-        if not dir_res.nodes then
-            dir_res.nodes = {}
+        local values = (dir_res and dir_res.nodes) or dir_res

Review Comment:
   `or dir_res` is useful.
   
   when we run the test case of: https://github.com/apache/apisix/blob/master/t/core/etcd-sync.t#L198-L216
   
   here `dir_res` = `res.body.list`, changed here: https://github.com/apache/apisix/pull/7630/files#diff-0dd73f147a1cb8d7591792a953ffd7714e5d41ef8123aeb681046b1dcbfef668R306
   
   the data struct like:
   
   ```json
   "body": {
   	"list": {
               ...element
       }
   }
   ```
   
   and the `values` = `dir_res.list`
   
   
   in other cases,  `dir_res` = `res.body.node`, the data struct like:
   
   ```json
   "body": {
   	"node": {
             "nodes": {
                 ...element
             }
       }
   }
   ```
   
   the `values` = `dir_res.node.nodes`
   
   `(dir_res and dir_res.nodes) or dir_res` is meant to be compatible with both.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on a diff in pull request #7630: change: adjust response format for V3 feature

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7630:
URL: https://github.com/apache/apisix/pull/7630#discussion_r942111333


##########
apisix/core/config_etcd.lua:
##########
@@ -212,14 +212,15 @@ local function load_full_data(self, dir_res, headers)
         self:upgrade_version(item.modifiedIndex)
 
     else
-        if not dir_res.nodes then
-            dir_res.nodes = {}
+        local values = (dir_res and dir_res.nodes) or dir_res

Review Comment:
   Got it. Would you mind adding a comment?



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org