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(patch_obligation): Fix patch request bugs in obligation #49

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

deo002
Copy link
Collaborator

@deo002 deo002 commented Mar 15, 2024

When we unmarshal json, the undefined keys take zero values in structs. So, there is no way to differentiate between an undefined value and an actual zero value when it is passed in json in a PATCH request.
Example:
{
"active": false,
"text": "Lorem ipsum"
}
and
{
"text": "Lorem ipsum"
}
Structs of both these unmarshalled json objects will have active as false.

@deo002 deo002 requested review from GMishx and avinal March 15, 2024 08:31
Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

Changes looks good.

@deo002 deo002 force-pushed the obligation_data_fix_1 branch from 023b62c to afc2cd9 Compare March 29, 2024 07:24
@deo002 deo002 requested a review from GMishx March 29, 2024 07:26
Copy link
Member

@avinal avinal left a comment

Choose a reason for hiding this comment

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

Looks good to me

pkg/models/types.go Outdated Show resolved Hide resolved
@deo002 deo002 force-pushed the obligation_data_fix_1 branch from afc2cd9 to 9ecd629 Compare March 29, 2024 10:40
@deo002 deo002 requested a review from GMishx March 29, 2024 10:47
Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

Tested, working as expected.

@GMishx GMishx removed the needs test label Mar 29, 2024
@GMishx GMishx merged commit 13760df into fossology:main Mar 29, 2024
5 checks passed
@GMishx GMishx deleted the obligation_data_fix_1 branch March 29, 2024 11:52
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.

3 participants