Skip to content

Commit

Permalink
Merge pull request #941 from weichou1229/issue-4989
Browse files Browse the repository at this point in the history
fix: Allow binary reading value to be empty
  • Loading branch information
cloudxxx8 authored Nov 8, 2024
2 parents bbedcee + d524d8c commit a873294
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dtos/reading.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type SimpleReading struct {
}

type BinaryReading struct {
BinaryValue []byte `json:"binaryValue,omitempty" validate:"omitempty,gt=0"`
BinaryValue []byte `json:"binaryValue,omitempty" validate:"omitempty"`
MediaType string `json:"mediaType,omitempty" validate:"required_with=BinaryValue"`
}

Expand Down
2 changes: 1 addition & 1 deletion dtos/requests/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestAddEventRequest_Validate(t *testing.T) {
{"invalid AddEventRequest, no Reading ValueType", invalidReadingNoValueType, true},
{"invalid AddEventRequest, invalid Reading ValueType", invalidReadingInvalidValueType, true},
{"invalid AddEventRequest, no SimpleReading Value", invalidSimpleReadingNoValue, true},
{"invalid AddEventRequest, no BinaryReading BinaryValue", invalidBinaryReadingNoValue, true},
{"valid AddEventRequest, no BinaryReading BinaryValue", invalidBinaryReadingNoValue, false},
{"invalid AddEventRequest, no BinaryReading MediaType", invalidBinaryReadingNoMedia, true},
{"valid AddEventRequest, nil Binary value", nilBinaryReadingNoMedia, false},
{"valid AddEventRequest, nil Simple value", nilSimpleReading, false},
Expand Down

0 comments on commit a873294

Please sign in to comment.