Skip to content
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(processTags): remove extra qoutes that added to slice and map type #407

Open

Conversation

@m-amr
Copy link

@m-amr m-amr commented Sep 24, 2019

when use json tag have a string value it should convert numbers and boolean to string
but it should not add qoutes to slice and map type as go json package do.

issue #395

when use json tag have a string value it should convert numbers and boolean to string
but iy should not add qoutes to slice and map type as go json package do.

issue #395
@m-amr m-amr force-pushed the m-amr:fix_marshel_non_string_type_with_string_json_tag branch from 9b1354e to 3c4fb2b Sep 24, 2019
@codecov
Copy link

@codecov codecov bot commented Sep 24, 2019

Codecov Report

Merging #407 into master will not change coverage.
The diff coverage is 75%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #407   +/-   ##
=======================================
  Coverage   81.72%   81.72%           
=======================================
  Files          41       41           
  Lines        5029     5029           
=======================================
  Hits         4110     4110           
  Misses        798      798           
  Partials      121      121
Impacted Files Coverage Δ
reflect_struct_encoder.go 88.98% <100%> (ø) ⬆️
reflect_extension.go 82.98% <100%> (ø) ⬆️
reflect_struct_decoder.go 48.32% <33.33%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 819acad...3c4fb2b. Read the comment docs.

@taowen
Copy link
Contributor

@taowen taowen commented Oct 17, 2019

please include tests for the bug

@m-amr
Copy link
Author

@m-amr m-amr commented Oct 17, 2019

@taowen
I have added this test case to cover this bugs
https://github.com/json-iterator/go/pull/407/files#diff-125ba0adcdc7ae889dca6e587c42adbaR140

Do you need to add more test cases ?

I think that the coverage decreased because
https://codecov.io/gh/json-iterator/go/commit/3c4fb2b2cf9e4988c73bdd1db8132fe22a13d7d5#diff-cmVmbGVjdF9zdHJ1Y3RfZW5jb2Rlci5nbw==

stringModeNonStringEncoder encode and decode will not be hit in case of slice or map.

@AllenX2018
Copy link
Collaborator

@AllenX2018 AllenX2018 commented Jan 14, 2020

IMO, if the field's type is struct or implements json.Marshaler, the bug still exists with this solution.

@@ -1042,7 +1042,7 @@ func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterato
}
c = iter.readByte()
if c != '"' {
iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c}))
iter.ReportError("stringModeNonStringDecoder", `expect ", but found `+string([]byte{c}))

This comment has been minimized.

@AllenX2018

AllenX2018 Jan 14, 2020
Collaborator

Maybe it needs a testcase to cover these new added lines to avoid the coverage diff reported by codecov.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.