gin
gin copied to clipboard
Support custom json codec at runtime
Extract out an interface api.JsonApi
to restrict all serialization and deserialization behaviors.
Developers only need to implement this interface and cover json.API
value can realize custom json codec.
In the future, we can define api.XmlApi
in the same way.
Solved #3217
Codecov Report
Merging #3222 (c654eb0) into master (a0acf1d) will increase coverage by
0.10%
. The diff coverage is100.00%
.
:exclamation: Current head c654eb0 differs from pull request most recent head 8bbf3eb. Consider uploading reports for the commit 8bbf3eb to get more accurate results
@@ Coverage Diff @@
## master #3222 +/- ##
==========================================
+ Coverage 98.27% 98.37% +0.10%
==========================================
Files 42 43 +1
Lines 3137 3148 +11
==========================================
+ Hits 3083 3097 +14
+ Misses 40 38 -2
+ Partials 14 13 -1
Flag | Coverage Δ | |
---|---|---|
? |
||
go-1.15 | 98.37% <100.00%> (?) |
|
go-1.16 | 98.35% <100.00%> (∅) |
|
go-1.17 | 98.28% <100.00%> (+0.10%) |
:arrow_up: |
go-1.18 | 98.28% <100.00%> (+0.10%) |
:arrow_up: |
go-1.19 | ? |
|
macos-latest | 98.37% <100.00%> (+0.19%) |
:arrow_up: |
nomsgpack | 98.35% <100.00%> (?) |
|
ubuntu-latest | 98.37% <100.00%> (+0.10%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
binding/form_mapping.go | 100.00% <100.00%> (ø) |
|
binding/json.go | 100.00% <100.00%> (ø) |
|
errors.go | 100.00% <100.00%> (ø) |
|
render/json.go | 83.14% <100.00%> (ø) |
|
mode.go | 100.00% <0.00%> (ø) |
|
tree.go | 100.00% <0.00%> (ø) |
|
routergroup.go | 100.00% <0.00%> (ø) |
|
test_helpers.go | 100.00% <0.00%> (ø) |
|
binding/binding_nomsgpack.go | 100.00% <0.00%> (ø) |
|
... and 1 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
@thinkerou PTAL, thks.
@thinkerou Could you make a code review for this PR. Thanks a lot.
@thinkerou @appleboy Please make a code review, thanks. We really need this feature in our project.
please also update readme, and add example code, thanks
please also update readme, and add example code, thanks
@thinkerou
I extract out an interface api.JsonApi
to restrict all serialization and deserialization behaviors.
Developers only need to implement this interface and cover json.API
value can realize custom json codec.
In the future, we can define api.XmlApi
in the same way.
And I also add examples in readme.
PTAL, thanks.
@thinkerou
@appleboy PLTA, thanks very much.
@timandy thanks a lot! the pull request have big modification and please review @appleboy @javierprovecho
@thinkerou In the previous force push, I fixed the format of the example in the readme file.
Any progress?
@appleboy @thinkerou @javierprovecho Please take a look