Skip to content

Commit e155413

Browse files
authored
Merge pull request #623 from albertsundjaja/group-stack-advanced-incorrectly
Group field whose elements do not have the same fields are incorrectly parsed
2 parents 9886e68 + de36465 commit e155413

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

validation.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ func validateVisitGroupField(fieldDef *datadictionary.FieldDef, fieldStack []Tag
246246
if childDefs[0].Required() {
247247
return fieldStack, RequiredTagMissing(Tag(childDefs[0].Tag()))
248248
}
249-
fieldStack = fieldStack[1:]
250249
}
251250

252251
childDefs = childDefs[1:]

validation_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func TestValidate(t *testing.T) {
7474
tcInvalidTagCheckDisabledFixT(),
7575
tcInvalidTagCheckEnabled(),
7676
tcInvalidTagCheckEnabledFixT(),
77+
tcMultipleRepeatingGroupFields(),
7778
}
7879

7980
msg := NewMessage()
@@ -923,6 +924,17 @@ func tcFloatValidationFixT() validateTest {
923924
}
924925
}
925926

927+
func tcMultipleRepeatingGroupFields() validateTest {
928+
dict, _ := datadictionary.Parse("spec/FIX43.xml")
929+
validator := NewValidator(defaultValidatorSettings, dict, nil)
930+
return validateTest{
931+
TestName: "Multiple repeating group fields in a message",
932+
Validator: validator,
933+
MessageBytes: []byte("8=FIX.4.39=17635=D34=249=TW52=20140329-22:38:4556=ISLD11=ID453=2448=PARTYID452=3523=SUBID448=PARTYID2452=378=179=ACCOUNT80=121=140=154=138=20055=INTC60=20140329-22:38:4510=178"),
934+
DoNotExpectReject: true,
935+
}
936+
}
937+
926938
func TestValidateVisitField(t *testing.T) {
927939
fieldType0 := datadictionary.NewFieldType("myfield", 11, "STRING")
928940
fieldDef0 := &datadictionary.FieldDef{FieldType: fieldType0}

0 commit comments

Comments
 (0)