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 omitted functionallity #10

Merged
merged 5 commits into from
Sep 11, 2024
Merged

Add omitted functionallity #10

merged 5 commits into from
Sep 11, 2024

Conversation

wneessen
Copy link
Owner

This PR adds the Omitted() methods which allows the user to identify if a null JSON value was sent as actual null or was completely omitted from the JSON. This can be helpful in case the JSON requires some mandatory fields.

Reorganized methods to ensure a logical method order and added the `present` field to track omitted values in JSON. This improves clarity and functionality by correctly indicating when a value was omitted.
Moved type declarations for Nil* variables to the top for better readability and organization. JSON marshal and unmarshal methods have been repositioned towards the bottom of the file to keep related logic together.
Moved NewVariable above the receiver methods
Introduce a new test, `TestVariable_Omitted`, to verify the behavior of the `NilBoolean` type fields, ensuring the correct handling of omitted and non-omitted fields during JSON unmarshalling.
Corrected the spelling of the `Omitted` method to ensure consistency and avoid potential confusion. This change does not affect the functionality but improves code readability and accuracy.
@wneessen wneessen merged commit 34dd908 into main Sep 11, 2024
7 checks passed
@wneessen wneessen deleted the omitted branch September 11, 2024 09:38
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7bddca9) to head (68fe249).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #10   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           27        30    +3     
=========================================
+ Hits            27        30    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants