Skip to content

Commit

Permalink
Merge pull request #623 from albertsundjaja/group-stack-advanced-inco…
Browse files Browse the repository at this point in the history
…rrectly

Group field whose elements do not have the same fields are incorrectly parsed
  • Loading branch information
ackleymi committed Apr 22, 2024
2 parents 9886e68 + de36465 commit e155413
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ func validateVisitGroupField(fieldDef *datadictionary.FieldDef, fieldStack []Tag
if childDefs[0].Required() {
return fieldStack, RequiredTagMissing(Tag(childDefs[0].Tag()))
}
fieldStack = fieldStack[1:]
}

childDefs = childDefs[1:]
Expand Down
12 changes: 12 additions & 0 deletions validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func TestValidate(t *testing.T) {
tcInvalidTagCheckDisabledFixT(),
tcInvalidTagCheckEnabled(),
tcInvalidTagCheckEnabledFixT(),
tcMultipleRepeatingGroupFields(),
}

msg := NewMessage()
Expand Down Expand Up @@ -923,6 +924,17 @@ func tcFloatValidationFixT() validateTest {
}
}

func tcMultipleRepeatingGroupFields() validateTest {
dict, _ := datadictionary.Parse("spec/FIX43.xml")
validator := NewValidator(defaultValidatorSettings, dict, nil)
return validateTest{
TestName: "Multiple repeating group fields in a message",
Validator: validator,
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"),
DoNotExpectReject: true,
}
}

func TestValidateVisitField(t *testing.T) {
fieldType0 := datadictionary.NewFieldType("myfield", 11, "STRING")
fieldDef0 := &datadictionary.FieldDef{FieldType: fieldType0}
Expand Down

0 comments on commit e155413

Please sign in to comment.