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

Add JSON marshalling and unmarshalling #71

Merged
merged 18 commits into from
Dec 25, 2024
Merged

Add JSON marshalling and unmarshalling #71

merged 18 commits into from
Dec 25, 2024

Conversation

AlekSi
Copy link
Member

@AlekSi AlekSi commented Dec 24, 2024

Closes #49.
Closes #70.

@AlekSi AlekSi added the not ready Issues that are not ready to be worked on; PRs that should skip CI label Dec 24, 2024
@AlekSi AlekSi self-assigned this Dec 24, 2024
@AlekSi AlekSi removed the not ready Issues that are not ready to be worked on; PRs that should skip CI label Dec 25, 2024
@AlekSi AlekSi requested a review from Copilot December 25, 2024 12:18
@AlekSi AlekSi changed the title Json Add JSON marshalling and unmarshalling Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (5)

wirebson/bson_test.go:370

  • The JSON key is empty. JSON keys should be meaningful and not empty to avoid confusion and potential issues.
"": "foo",

wirebson/bson_test.go:796

  • The JSON key is empty. JSON keys should be meaningful and not empty to avoid confusion and potential issues.
"": false,

wirebson/array.go:184

  • The new method MarshalJSON should be covered by tests to ensure its functionality.
func (arr *Array) MarshalJSON() ([]byte, error) {

wirebson/array.go:209

  • The new method UnmarshalJSON should be covered by tests to ensure its functionality.
func (arr *Array) UnmarshalJSON(b []byte) error {

wirebson/binary.go:91

  • The removal of the conditional check before making a slice and copying bytes might introduce unintended behavior if 'i' is zero. Consider restoring the check.
res.B = make([]byte, i)
Copy link

codecov bot commented Dec 25, 2024

Codecov Report

Attention: Patch coverage is 29.03226% with 44 lines in your changes missing coverage. Please review.

Project coverage is 62.93%. Comparing base (f782d49) to head (899bdb3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
wirebson/array.go 0.00% 30 Missing ⚠️
wirebson/document.go 53.33% 10 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   63.88%   62.93%   -0.95%     
==========================================
  Files          41       41              
  Lines        2337     2396      +59     
==========================================
+ Hits         1493     1508      +15     
- Misses        662      702      +40     
- Partials      182      186       +4     
Files with missing lines Coverage Δ
wirebson/binary.go 75.00% <100.00%> (-1.00%) ⬇️
wirebson/document.go 46.25% <53.33%> (+1.63%) ⬆️
wirebson/array.go 47.05% <0.00%> (-15.87%) ⬇️
Flag Coverage Δ
test 62.93% <29.03%> (-0.95%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@AlekSi AlekSi marked this pull request as ready for review December 25, 2024 12:23
@AlekSi AlekSi merged commit e3aefb9 into FerretDB:main Dec 25, 2024
6 of 9 checks passed
@AlekSi AlekSi deleted the json branch December 25, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add MarshalJSON methods to *Document / *Array
2 participants