-
Notifications
You must be signed in to change notification settings - Fork 16
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 (CoRIM Extensions) : Incorrect Assumptions on Measurement Values Map validity #141
base: main
Are you sure you want to change the base?
Changes from 1 commit
e6b0fdc
e5debd3
748c338
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -424,6 +424,7 @@ func (o Mval) MarshalJSON() ([]byte, error) { | |
} | ||
|
||
func (o Mval) Valid() error { | ||
// Check if all base types are nil and Extensions are not nil | ||
if o.Ver == nil && | ||
o.SVN == nil && | ||
o.Digests == nil && | ||
|
@@ -436,7 +437,10 @@ func (o Mval) Valid() error { | |
o.UEID == nil && | ||
o.UUID == nil && | ||
o.IntegrityRegisters == nil { | ||
return fmt.Errorf("no measurement value set") | ||
|
||
if o.Extensions.IsEmpty() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not include this in the conjunction? I don’t see a reason for the nested if. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I uses nested if statements for simpler view of the conditions. However, if using a conjunction is preferred for better readability, I can change it accordingly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer it. I don’t think there’s anything about this condition that needs special attention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback! it's cleaner with conjunctions. I've updated the code |
||
return fmt.Errorf("no measurement value set") | ||
} | ||
} | ||
|
||
if o.Ver != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to be a method comment, “Valid returns true if all […]” since Valid is exported but doesn’t have a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the Valid method to include a comment and moved the check for empty extensions as suggested.