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/02/25 09:55:53 UTC

[GitHub] [apisix-ingress-controller] cmssczy opened a new pull request #888: fix json unmarshal error when list plguins

cmssczy opened a new pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888


   <!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   <!-- Please delete options that are not relevant. -->
   
   - [x] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   bug fix https://github.com/apache/apisix-ingress-controller/issues/883
   the response body is JSON with unknown field names but not a string slice.
   ### Pre-submission checklist:
   
   <!--
   Please follow the requirements:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. Use "request review" to notify the reviewer once you have resolved the review
   -->
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix-ingress-controller#community) first**
   


-- 
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-ingress-controller] lingsamuel commented on pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
lingsamuel commented on pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#issuecomment-1056018001


   We need a mechanism to ensure that the APISIX interface we are using is not outdated.


-- 
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-ingress-controller] tao12345666333 commented on pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#issuecomment-1054830124


   Thanks! It's on my list


-- 
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-ingress-controller] cmssczy commented on pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
cmssczy commented on pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#issuecomment-1054905133


   > could you give us an example about the response? Fair to say, I didn't realize the difference.
   
   @tokers 
   The response body json format is like:
   ```json
   {
   	"serverless-pre-function": {
   		"version": 0.1,
   		"priority": 10000
   	},
   	"echo": {
   		"version": 0.1,
   		"priority": 412
   	}
   }
   ```
   It is a json struct with unknown field names but not a string slice. So I think we should use a `map` instead of `slice`.


-- 
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-ingress-controller] tao12345666333 merged pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
tao12345666333 merged pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888


   


-- 
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-ingress-controller] codecov-commenter commented on pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#issuecomment-1051551879


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#888](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d23462a) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/e2475cf8573f9f1efd6956c0e4e6eab2142b8061?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e2475cf) will **decrease** coverage by `0.25%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #888      +/-   ##
   ==========================================
   - Coverage   32.01%   31.76%   -0.26%     
   ==========================================
     Files          70       70              
     Lines        7749     7754       +5     
   ==========================================
   - Hits         2481     2463      -18     
   - Misses       4993     5009      +16     
   - Partials      275      282       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `29.53% <100.00%> (-3.05%)` | :arrow_down: |
   | [pkg/apisix/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9wbHVnaW4uZ28=) | `80.00% <0.00%> (-20.00%)` | :arrow_down: |
   | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `36.91% <0.00%> (-2.02%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e2475cf...d23462a](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-ingress-controller] tao12345666333 commented on pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#issuecomment-1056024988


   > We need a mechanism to ensure that the APISIX interface we are using is not outdated.
   
   yep. we may need to convert directly from the upstream schema.
   
   now let's move forward.


-- 
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-ingress-controller] tokers commented on a change in pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#discussion_r816386059



##########
File path: pkg/apisix/cluster.go
##########
@@ -750,10 +750,16 @@ func (c *cluster) getList(ctx context.Context, url, resource string) ([]string,
 		return nil, err
 	}
 
-	var listResponse []string
+	var listResponse map[string]interface{}
 	dec := json.NewDecoder(resp.Body)
 	if err := dec.Decode(&listResponse); err != nil {
 		return nil, err
 	}
-	return listResponse, nil
+	var res []string = make([]string, len(listResponse))

Review comment:
       ```suggestion
   	res []string := make([]string, 0, len(listResponse))
   ```
   
   After that, just using `append`, we don't need the indice `i`.




-- 
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-ingress-controller] cmssczy commented on a change in pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
cmssczy commented on a change in pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#discussion_r816394259



##########
File path: pkg/apisix/cluster.go
##########
@@ -750,10 +750,16 @@ func (c *cluster) getList(ctx context.Context, url, resource string) ([]string,
 		return nil, err
 	}
 
-	var listResponse []string
+	var listResponse map[string]interface{}
 	dec := json.NewDecoder(resp.Body)
 	if err := dec.Decode(&listResponse); err != nil {
 		return nil, err
 	}
-	return listResponse, nil
+	var res []string = make([]string, len(listResponse))

Review comment:
       Done




-- 
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-ingress-controller] codecov-commenter edited a comment on pull request #888: fix json unmarshal error when list plguins

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#issuecomment-1051551879


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#888](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4c0ed87) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/e2475cf8573f9f1efd6956c0e4e6eab2142b8061?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e2475cf) will **increase** coverage by `0.02%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head 4c0ed87 differs from pull request most recent head 1740faf. Consider uploading reports for the commit 1740faf to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #888      +/-   ##
   ==========================================
   + Coverage   32.01%   32.04%   +0.02%     
   ==========================================
     Files          70       70              
     Lines        7749     7752       +3     
   ==========================================
   + Hits         2481     2484       +3     
     Misses       4993     4993              
     Partials      275      275              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `33.03% <100.00%> (+0.45%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e2475cf...1740faf](https://codecov.io/gh/apache/apisix-ingress-controller/pull/888?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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