Skip to content

Commit

Permalink
Merge pull request #141 from Priyanshuthapliyal2005/fixExt
Browse files Browse the repository at this point in the history
fix (CoRIM Extensions) : Incorrect Assumptions on Measurement Values Map validity
  • Loading branch information
deeglaze authored Jan 19, 2025
2 parents 7a541c4 + 050969d commit e629156
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion comid/measurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ func (o Mval) MarshalJSON() ([]byte, error) {
return encoding.SerializeStructToJSON(o)
}

// Valid returns an error if none of the measurement values are set and the Extensions are empty.
// nolint:gocritic
func (o Mval) Valid() error {
// Check if no measurement values are set
Expand All @@ -439,7 +440,8 @@ func (o Mval) Valid() error {
o.SerialNumber == nil &&
o.UEID == nil &&
o.UUID == nil &&
o.IntegrityRegisters == nil {
o.IntegrityRegisters == nil &&
o.Extensions.IsEmpty() {
return fmt.Errorf("no measurement value set")
}

Expand Down

0 comments on commit e629156

Please sign in to comment.