-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(be): Modify the upstream to use the new JSON patch package #1395
fix(be): Modify the upstream to use the new JSON patch package #1395
Conversation
@Jaycean In order to be a semantic pull request, please change the title to |
Codecov Report
@@ Coverage Diff @@
## master #1395 +/- ##
===========================================
+ Coverage 44.72% 66.97% +22.24%
===========================================
Files 35 44 +9
Lines 2522 2937 +415
===========================================
+ Hits 1128 1967 +839
+ Misses 1233 729 -504
- Partials 161 241 +80
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jaycean Since #1396 has been merged already, the Upstream is the only resource that's using github.com/api7/go-jsonpatch
. So within this PR, we would better completely remove the dependency of github.com/api7/go-jsonpatch
.
Please rebase the master branch with the latest code and run go mod tidy
for that. Thanks.
657431f
to
bfdea43
Compare
Thanks for the reminder.done. |
@nic-chen Backend E2E Test seems broken since this morning, prompted with the following error. Could you please have a check? Thanks.
|
} | ||
input := c.Input().(*PatchInput) | ||
reqBody := input.Body | ||
ID := input.ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use variables started with letter in small case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Thks
if err := patch.Apply(&stored); err != nil { | ||
var upstream entity.Upstream | ||
err = json.Unmarshal(res, &upstream) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged into:
if err := json.Unmarshal(res, &upstream); err != nil {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Thks
if err := patch.Apply(&stored); err != nil { | ||
var upstream entity.Upstream | ||
err = json.Unmarshal(res, &upstream) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged into:
if err := json.Unmarshal(res, &upstream); err != nil {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Thks
@@ -314,3 +314,4 @@ func (h *Handler) listUpstreamNames(c droplet.Context) (interface{}, error) { | |||
|
|||
return output, nil | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keep an empty line here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my problem. Maybe I forgot to delete it when using vim. Done. Thks
@imjoey @Jaycean hi, have you found the reason of the failure of ci? |
This request |
@Jaycean CI passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thanks @Jaycean .
Great Thks. |
Please answer these questions before submitting a pull request
Why submit this pull request?
Bugfix
New feature provided
Improve performance
Backport patches
Related issues
feat: Modify the usage of upstream and service go-jsonpatch to json-patch/v5 #1392
feat: Improve testing coverage for the POST and PATCH methods of the resources #1332
Bugfix
Description
I find that the jsonpatch(github.com/api7/go-jsonpatch) used by upstream and service when calling the patch method is still the old package,updated to github.com/evanphx/json-patch/v5
How to fix?
Modify the upstream to use the new JSON patch package