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 (CoRIM Extensions) : Incorrect Assumptions on Measurement Values Map validity #141

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Priyanshuthapliyal2005
Copy link

Fixes #134

@Priyanshuthapliyal2005 Priyanshuthapliyal2005 marked this pull request as draft December 24, 2024 12:51
@Priyanshuthapliyal2005 Priyanshuthapliyal2005 marked this pull request as draft December 24, 2024 12:51
@Priyanshuthapliyal2005 Priyanshuthapliyal2005 marked this pull request as draft December 24, 2024 12:51
@Priyanshuthapliyal2005 Priyanshuthapliyal2005 marked this pull request as draft December 24, 2024 12:51
@@ -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() {
Copy link
Collaborator

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.

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.

Copy link
Collaborator

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

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

@Priyanshuthapliyal2005 Priyanshuthapliyal2005 force-pushed the fixExt branch 2 times, most recently from 5a0ffef to c32f413 Compare December 25, 2024 09:42
@@ -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
Copy link
Collaborator

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.

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.

@Priyanshuthapliyal2005 Priyanshuthapliyal2005 force-pushed the fixExt branch 2 times, most recently from 67fba18 to 8830b3c Compare December 25, 2024 11:13
Signed-off-by: Priyanshu Thapliyal <[email protected]>
Copy link
Contributor

@yogeshbdeshpande yogeshbdeshpande left a 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!

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.

CoRIM Extensions: Incorrect Assumptions on Measurement Values Map validity
4 participants