-
Notifications
You must be signed in to change notification settings - Fork 494
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
avoid escaping json schema and fix bugs related to multi-level dynamic object #272
Conversation
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.
[TASK:easegress-pr-test FAILED]megaease/easegress Pull Request 272 Deploy Test failed
Codecov Report
@@ Coverage Diff @@
## main #272 +/- ##
==========================================
+ Coverage 80.22% 80.30% +0.07%
==========================================
Files 53 53
Lines 5897 5926 +29
==========================================
+ Hits 4731 4759 +28
Misses 907 907
- Partials 259 260 +1
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.
[TASK:easegress-pr-test FAILED]megaease/easegress Pull Request 272 Deploy Test failed
@@ -312,6 +313,39 @@ func (cr CustomResource) Kind() string { | |||
return "" | |||
} | |||
|
|||
// MarshalJSON implements json.Marshaler |
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.
You can do a research of https://github.com/json-iterator/go , which might already have done it.
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.
yes, json-iterator
can handle this case, thanks for the advice.
btw, I think the document of json-iterator
is inaccurate as it says "100% compatible with encoding/json
", at least in this 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.
Compatible means it includes standard lib here. it depends on how you understand it. Golang1.17 is compatible with Golang 1.0 with bringing a lot of new features.
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.
After thinking the issue twice, I think it is better to keep this function:
This function is always a correct solution, no matter we are using encoding/json
or json-iterator
.
If we remove it, then we are forcing future code to use json-iterator
, but this is an implicit requirement, which means we are very possible to meet this bug again if encoding/json
is used in new code.
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.
Sure, I have no opposite opinion
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.
Because I found other issues with this implementation, I've moved the type conversion stuff to UnmarshalYAML
.
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
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
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
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.
[TASK:easegress-pr-test SUCCESS]megaease/easegress Pull Request 272 Deploy Test Success
No description provided.