Closed
Description
We are generating Encoders/Decoders for go.
In our schema, we have a field, defined as follows:
<field name="position" id="2" type="uint64" presence="optional" />
Our question goes to the range-checking which can be enabled in the generated decoder.
We observe that the check is generated as follows, regardless whether the presence="optional"
attribute is set or not:
if s.PositionInActingVersion(actingVersion) {
if s.Position < s.PositionMinValue() || s.Position > s.PositionMaxValue() {
return fmt.Errorf("Range check failed on s.Position (%d < %d > %d)", s.PositionMinValue(), s.Position, s.PositionMaxValue())
}
}
If a null
value is received, it will be s.PositionMaxValue() + 1
.
Our question is: should the range check code accommodate for null values or are we maybe confusing something?
Metadata
Metadata
Assignees
Labels
No labels