more work on struct validation

This commit is contained in:
tsmethurst 2021-08-30 20:20:27 +02:00
commit 356d28fef9
12 changed files with 640 additions and 202 deletions

View file

@ -101,7 +101,7 @@ func (suite *StatusValidateTestSuite) TestValidateStatusAttachmentIDs() {
s.AttachmentIDs[0] = ""
err := gtsmodel.ValidateStruct(*s)
suite.EqualError(err, "Key: 'Status.AttachmentIDs[0]' Error:Field validation for 'AttachmentIDs[0]' failed on the 'required' tag")
suite.EqualError(err, "Key: 'Status.AttachmentIDs[0]' Error:Field validation for 'AttachmentIDs[0]' failed on the 'ulid' tag")
s.AttachmentIDs[0] = "01FE96W293ZPRG9FQQP48HK8N001FE96W32AT24VYBGM12WN3GKB"
err = gtsmodel.ValidateStruct(*s)
@ -109,7 +109,7 @@ func (suite *StatusValidateTestSuite) TestValidateStatusAttachmentIDs() {
s.AttachmentIDs[1] = ""
err = gtsmodel.ValidateStruct(*s)
suite.EqualError(err, "Key: 'Status.AttachmentIDs[0]' Error:Field validation for 'AttachmentIDs[0]' failed on the 'ulid' tag\nKey: 'Status.AttachmentIDs[1]' Error:Field validation for 'AttachmentIDs[1]' failed on the 'required' tag")
suite.EqualError(err, "Key: 'Status.AttachmentIDs[0]' Error:Field validation for 'AttachmentIDs[0]' failed on the 'ulid' tag\nKey: 'Status.AttachmentIDs[1]' Error:Field validation for 'AttachmentIDs[1]' failed on the 'ulid' tag")
s.AttachmentIDs = []string{}
err = gtsmodel.ValidateStruct(*s)