-
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?
fix (CoRIM Extensions) : Incorrect Assumptions on Measurement Values Map validity #141
Conversation
…ement values Signed-off-by: Priyanshu Thapliyal <[email protected]>
183b423
to
e6b0fdc
Compare
comid/measurement.go
Outdated
@@ -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 comment
The 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 comment
The 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 comment
The 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 comment
The 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
711e3d6
to
2192da5
Compare
…surement values Signed-off-by: Priyanshu Thapliyal <[email protected]>
5a0ffef
to
c32f413
Compare
comid/measurement.go
Outdated
@@ -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 |
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.
67fba18
to
8830b3c
Compare
Signed-off-by: Priyanshu Thapliyal <[email protected]>
8830b3c
to
748c338
Compare
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.
LGTM! Thanks for making the change!
Fixes #134