diff --git a/gen/acmt_022_001_02/validate.go b/gen/acmt_022_001_02/validate.go index dc7ba81..147fad4 100644 --- a/gen/acmt_022_001_02/validate.go +++ b/gen/acmt_022_001_02/validate.go @@ -11,8 +11,9 @@ import ( func (v AccountIdentification4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AccountIdentification4Choice" if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -22,7 +23,8 @@ func (v AccountIdentification4Choice) Validate() error { func (v BranchAndFinancialInstitutionIdentification5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification5" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -31,7 +33,8 @@ func (v BranchAndFinancialInstitutionIdentification5) Validate() error { func (v BranchAndFinancialInstitutionIdentification5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification5TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -40,7 +43,8 @@ func (v BranchAndFinancialInstitutionIdentification5TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -49,7 +53,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -58,7 +63,8 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.IdModAdvc.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".IdModAdvc", v.IdModAdvc.Validate()) if errs.Empty() { return nil } @@ -67,7 +73,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification8) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification8" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -76,7 +83,8 @@ func (v FinancialInstitutionIdentification8) Validate() error { func (v FinancialInstitutionIdentification8TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification8TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -85,7 +93,8 @@ func (v FinancialInstitutionIdentification8TCH) Validate() error { func (v GenericAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -94,10 +103,11 @@ func (v GenericAccountIdentification1) Validate() error { func (v IdentificationAssignment2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) + baseName := "IdentificationAssignment2" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) if errs.Empty() { return nil } @@ -106,10 +116,11 @@ func (v IdentificationAssignment2) Validate() error { func (v IdentificationAssignment2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) + baseName := "IdentificationAssignment2TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) if errs.Empty() { return nil } @@ -118,8 +129,9 @@ func (v IdentificationAssignment2TCH) Validate() error { func (v IdentificationInformation2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Acct.Validate()) - rtp.AddError(&errs, v.Agt.Validate()) + baseName := "IdentificationInformation2" + rtp.AddError(&errs, baseName+".Acct", v.Acct.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) if errs.Empty() { return nil } @@ -128,8 +140,9 @@ func (v IdentificationInformation2) Validate() error { func (v IdentificationInformation2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Acct.Validate()) - rtp.AddError(&errs, v.Agt.Validate()) + baseName := "IdentificationInformation2TCH" + rtp.AddError(&errs, baseName+".Acct", v.Acct.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) if errs.Empty() { return nil } @@ -138,13 +151,14 @@ func (v IdentificationInformation2TCH) Validate() error { func (v IdentificationModification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "IdentificationModification2" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.OrgnlPtyAndAcctId != nil { - rtp.AddError(&errs, v.OrgnlPtyAndAcctId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPtyAndAcctId", v.OrgnlPtyAndAcctId.Validate()) } - rtp.AddError(&errs, v.UpdtdPtyAndAcctId.Validate()) + rtp.AddError(&errs, baseName+".UpdtdPtyAndAcctId", v.UpdtdPtyAndAcctId.Validate()) if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -154,13 +168,14 @@ func (v IdentificationModification2) Validate() error { func (v IdentificationModification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "IdentificationModification2TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.OrgnlPtyAndAcctId != nil { - rtp.AddError(&errs, v.OrgnlPtyAndAcctId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPtyAndAcctId", v.OrgnlPtyAndAcctId.Validate()) } - rtp.AddError(&errs, v.UpdtdPtyAndAcctId.Validate()) + rtp.AddError(&errs, baseName+".UpdtdPtyAndAcctId", v.UpdtdPtyAndAcctId.Validate()) if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -170,9 +185,10 @@ func (v IdentificationModification2TCH) Validate() error { func (v IdentificationModificationAdviceV02) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) - rtp.AddError(&errs, v.Mod.Validate()) + baseName := "IdentificationModificationAdviceV02" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".Mod", v.Mod.Validate()) if errs.Empty() { return nil } @@ -181,9 +197,10 @@ func (v IdentificationModificationAdviceV02) Validate() error { func (v IdentificationModificationAdviceV02TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) - rtp.AddError(&errs, v.Mod.Validate()) + baseName := "IdentificationModificationAdviceV02TCH" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".Mod", v.Mod.Validate()) if errs.Empty() { return nil } @@ -192,10 +209,11 @@ func (v IdentificationModificationAdviceV02TCH) Validate() error { func (v OriginalTransactionReference18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.MsgNmId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlTx.Validate()) + baseName := "OriginalTransactionReference18" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".MsgNmId", v.MsgNmId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTx", v.OrgnlTx.Validate()) if errs.Empty() { return nil } @@ -204,10 +222,11 @@ func (v OriginalTransactionReference18) Validate() error { func (v OriginalTransactionReference18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.MsgNmId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlTx.Validate()) + baseName := "OriginalTransactionReference18TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".MsgNmId", v.MsgNmId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTx", v.OrgnlTx.Validate()) if errs.Empty() { return nil } @@ -216,8 +235,9 @@ func (v OriginalTransactionReference18TCH) Validate() error { func (v Party12Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party12Choice" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -227,8 +247,9 @@ func (v Party12Choice) Validate() error { func (v Party12ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party12ChoiceTCH" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -238,9 +259,10 @@ func (v Party12ChoiceTCH) Validate() error { func (v PaymentIdentification4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "PaymentIdentification4" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if errs.Empty() { return nil } @@ -249,9 +271,10 @@ func (v PaymentIdentification4) Validate() error { func (v PaymentIdentification4TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "PaymentIdentification4TCH" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if errs.Empty() { return nil } @@ -261,52 +284,54 @@ func (v PaymentIdentification4TCH) Validate() error { // XSD SimpleType validations func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max34Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 34)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 34); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.08", "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.08", "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } diff --git a/gen/admi_002_001_01/validate.go b/gen/admi_002_001_01/validate.go index a6d2bcb..00da369 100644 --- a/gen/admi_002_001_01/validate.go +++ b/gen/admi_002_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Admi00200101.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".Admi00200101", v.Admi00200101.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v DocumentTCH) Validate() error { func (v MessageReference) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Ref.Validate()) + baseName := "MessageReference" + rtp.AddError(&errs, baseName+".Ref", v.Ref.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v MessageReference) Validate() error { func (v MessageReferenceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Ref.Validate()) + baseName := "MessageReferenceTCH" + rtp.AddError(&errs, baseName+".Ref", v.Ref.Validate()) if errs.Empty() { return nil } @@ -38,8 +41,9 @@ func (v MessageReferenceTCH) Validate() error { func (v MessageRejectV01) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RltdRef.Validate()) - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "MessageRejectV01" + rtp.AddError(&errs, baseName+".RltdRef", v.RltdRef.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -48,8 +52,9 @@ func (v MessageRejectV01) Validate() error { func (v MessageRejectV01TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RltdRef.Validate()) - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "MessageRejectV01TCH" + rtp.AddError(&errs, baseName+".RltdRef", v.RltdRef.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -58,9 +63,10 @@ func (v MessageRejectV01TCH) Validate() error { func (v RejectionReason2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RjctgPtyRsn.Validate()) + baseName := "RejectionReason2" + rtp.AddError(&errs, baseName+".RjctgPtyRsn", v.RjctgPtyRsn.Validate()) if v.AddtlData != nil { - rtp.AddError(&errs, v.AddtlData.Validate()) + rtp.AddError(&errs, baseName+".AddtlData", v.AddtlData.Validate()) } if errs.Empty() { return nil @@ -70,9 +76,10 @@ func (v RejectionReason2) Validate() error { func (v RejectionReason2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RjctgPtyRsn.Validate()) + baseName := "RejectionReason2TCH" + rtp.AddError(&errs, baseName+".RjctgPtyRsn", v.RjctgPtyRsn.Validate()) if v.AddtlData != nil { - rtp.AddError(&errs, v.AddtlData.Validate()) + rtp.AddError(&errs, baseName+".AddtlData", v.AddtlData.Validate()) } if errs.Empty() { return nil @@ -83,22 +90,24 @@ func (v RejectionReason2TCH) Validate() error { // XSD SimpleType validations func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } diff --git a/gen/admi_004_001_02/validate.go b/gen/admi_004_001_02/validate.go index cc7f8f1..d58bc05 100644 --- a/gen/admi_004_001_02/validate.go +++ b/gen/admi_004_001_02/validate.go @@ -11,7 +11,8 @@ import ( func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SysEvtNtfctn.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".SysEvtNtfctn", v.SysEvtNtfctn.Validate()) if errs.Empty() { return nil } @@ -20,14 +21,15 @@ func (v DocumentTCH) Validate() error { func (v Event2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.EvtCd.Validate()) + baseName := "Event2" + rtp.AddError(&errs, baseName+".EvtCd", v.EvtCd.Validate()) for indx := range v.EvtParam { - rtp.AddError(&errs, v.EvtParam[indx].Validate()) + rtp.AddError(&errs, baseName+".EvtParam", v.EvtParam[indx].Validate()) } if v.EvtDesc != nil { - rtp.AddError(&errs, v.EvtDesc.Validate()) + rtp.AddError(&errs, baseName+".EvtDesc", v.EvtDesc.Validate()) } - rtp.AddError(&errs, v.EvtTm.Validate()) + rtp.AddError(&errs, baseName+".EvtTm", v.EvtTm.Validate()) if errs.Empty() { return nil } @@ -36,14 +38,15 @@ func (v Event2) Validate() error { func (v Event2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.EvtCd.Validate()) + baseName := "Event2TCH" + rtp.AddError(&errs, baseName+".EvtCd", v.EvtCd.Validate()) for indx := range v.EvtParam { - rtp.AddError(&errs, v.EvtParam[indx].Validate()) + rtp.AddError(&errs, baseName+".EvtParam", v.EvtParam[indx].Validate()) } if v.EvtDesc != nil { - rtp.AddError(&errs, v.EvtDesc.Validate()) + rtp.AddError(&errs, baseName+".EvtDesc", v.EvtDesc.Validate()) } - rtp.AddError(&errs, v.EvtTm.Validate()) + rtp.AddError(&errs, baseName+".EvtTm", v.EvtTm.Validate()) if errs.Empty() { return nil } @@ -52,7 +55,8 @@ func (v Event2TCH) Validate() error { func (v SystemEventNotificationV02) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.EvtInf.Validate()) + baseName := "SystemEventNotificationV02" + rtp.AddError(&errs, baseName+".EvtInf", v.EvtInf.Validate()) if errs.Empty() { return nil } @@ -61,7 +65,8 @@ func (v SystemEventNotificationV02) Validate() error { func (v SystemEventNotificationV02TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.EvtInf.Validate()) + baseName := "SystemEventNotificationV02TCH" + rtp.AddError(&errs, baseName+".EvtInf", v.EvtInf.Validate()) if errs.Empty() { return nil } @@ -71,32 +76,34 @@ func (v SystemEventNotificationV02TCH) Validate() error { // XSD SimpleType validations func (v Max1000Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 1000)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 1000); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max4AlphaNumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-zA-Z0-9]{1,4}`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-zA-Z0-9]{1,4}`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } diff --git a/gen/admn_001_001_01/validate.go b/gen/admn_001_001_01/validate.go index 60c883f..4ff8ef2 100644 --- a/gen/admn_001_001_01/validate.go +++ b/gen/admn_001_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AdmnSignOnReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AdmnSignOnReq", v.AdmnSignOnReq.Validate()) if errs.Empty() { return nil } @@ -38,7 +41,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -47,8 +51,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -57,8 +62,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -67,9 +73,10 @@ func (v GrpHdrTCH) Validate() error { func (v SignOnReq) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "SignOnReq" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -78,8 +85,9 @@ func (v SignOnReq) Validate() error { func (v SignOnRequest) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOnReq.Validate()) + baseName := "SignOnRequest" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOnReq", v.SignOnReq.Validate()) if errs.Empty() { return nil } @@ -88,8 +96,9 @@ func (v SignOnRequest) Validate() error { func (v SignOnRequestTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOnReq.Validate()) + baseName := "SignOnRequestTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOnReq", v.SignOnReq.Validate()) if errs.Empty() { return nil } @@ -98,9 +107,10 @@ func (v SignOnRequestTCH) Validate() error { func (v SignOnReqTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "SignOnReqTCH" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -110,43 +120,47 @@ func (v SignOnReqTCH) Validate() error { // XSD SimpleType validations func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } diff --git a/gen/admn_002_001_01/validate.go b/gen/admn_002_001_01/validate.go index d85525a..47ae333 100644 --- a/gen/admn_002_001_01/validate.go +++ b/gen/admn_002_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AdmnSignOnResp.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AdmnSignOnResp", v.AdmnSignOnResp.Validate()) if errs.Empty() { return nil } @@ -38,7 +41,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -47,8 +51,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -57,8 +62,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -67,12 +73,13 @@ func (v GrpHdrTCH) Validate() error { func (v SignOnResp) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.Sts.Validate()) + baseName := "SignOnResp" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".Sts", v.Sts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } if errs.Empty() { return nil @@ -82,8 +89,9 @@ func (v SignOnResp) Validate() error { func (v SignOnResponse) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOnResp.Validate()) + baseName := "SignOnResponse" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOnResp", v.SignOnResp.Validate()) if errs.Empty() { return nil } @@ -92,8 +100,9 @@ func (v SignOnResponse) Validate() error { func (v SignOnResponseTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOnResp.Validate()) + baseName := "SignOnResponseTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOnResp", v.SignOnResp.Validate()) if errs.Empty() { return nil } @@ -102,12 +111,13 @@ func (v SignOnResponseTCH) Validate() error { func (v SignOnRespTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.Sts.Validate()) + baseName := "SignOnRespTCH" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".Sts", v.Sts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } if errs.Empty() { return nil @@ -117,8 +127,9 @@ func (v SignOnRespTCH) Validate() error { func (v StatusReason6Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReason6Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -128,7 +139,8 @@ func (v StatusReason6Choice) Validate() error { func (v StatusReasonInformation8) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "StatusReasonInformation8" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -137,7 +149,8 @@ func (v StatusReasonInformation8) Validate() error { func (v StatusReasonInformation8TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "StatusReasonInformation8TCH" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -147,39 +160,35 @@ func (v StatusReasonInformation8TCH) Validate() error { // XSD SimpleType validations func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } func (v ProprietaryReasonCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "9946", "9948", "9964", "DS0H", "RC02")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "9946", "9948", "9964", "DS0H", "RC02"); err != nil { + return err } - return errs + return nil } func (v TransactionGroupStatus3CodeAdmin) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACTC", "RJCT")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACTC", "RJCT"); err != nil { + return err } - return errs + return nil } diff --git a/gen/admn_003_001_01/validate.go b/gen/admn_003_001_01/validate.go index fd523d1..b98c947 100644 --- a/gen/admn_003_001_01/validate.go +++ b/gen/admn_003_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AdmnSignOffReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AdmnSignOffReq", v.AdmnSignOffReq.Validate()) if errs.Empty() { return nil } @@ -38,7 +41,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -47,8 +51,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -57,8 +62,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -67,9 +73,10 @@ func (v GrpHdrTCH) Validate() error { func (v SignOffReq) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "SignOffReq" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -78,8 +85,9 @@ func (v SignOffReq) Validate() error { func (v SignOffRequest) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOffReq.Validate()) + baseName := "SignOffRequest" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOffReq", v.SignOffReq.Validate()) if errs.Empty() { return nil } @@ -88,8 +96,9 @@ func (v SignOffRequest) Validate() error { func (v SignOffRequestTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOffReq.Validate()) + baseName := "SignOffRequestTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOffReq", v.SignOffReq.Validate()) if errs.Empty() { return nil } @@ -98,9 +107,10 @@ func (v SignOffRequestTCH) Validate() error { func (v SignOffReqTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "SignOffReqTCH" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -110,43 +120,47 @@ func (v SignOffReqTCH) Validate() error { // XSD SimpleType validations func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } diff --git a/gen/admn_004_001_01/validate.go b/gen/admn_004_001_01/validate.go index 4d1b698..b956268 100644 --- a/gen/admn_004_001_01/validate.go +++ b/gen/admn_004_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AdmnSignOffResp.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AdmnSignOffResp", v.AdmnSignOffResp.Validate()) if errs.Empty() { return nil } @@ -38,7 +41,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -47,8 +51,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -57,8 +62,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -67,12 +73,13 @@ func (v GrpHdrTCH) Validate() error { func (v SignOffResp) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.Sts.Validate()) + baseName := "SignOffResp" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".Sts", v.Sts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } if errs.Empty() { return nil @@ -82,8 +89,9 @@ func (v SignOffResp) Validate() error { func (v SignOffResponse) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOffResp.Validate()) + baseName := "SignOffResponse" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOffResp", v.SignOffResp.Validate()) if errs.Empty() { return nil } @@ -92,8 +100,9 @@ func (v SignOffResponse) Validate() error { func (v SignOffResponseTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.SignOffResp.Validate()) + baseName := "SignOffResponseTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".SignOffResp", v.SignOffResp.Validate()) if errs.Empty() { return nil } @@ -102,12 +111,13 @@ func (v SignOffResponseTCH) Validate() error { func (v SignOffRespTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.Sts.Validate()) + baseName := "SignOffRespTCH" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".Sts", v.Sts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } if errs.Empty() { return nil @@ -117,8 +127,9 @@ func (v SignOffRespTCH) Validate() error { func (v StatusReason6Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReason6Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -128,7 +139,8 @@ func (v StatusReason6Choice) Validate() error { func (v StatusReasonInformation8) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "StatusReasonInformation8" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -137,7 +149,8 @@ func (v StatusReasonInformation8) Validate() error { func (v StatusReasonInformation8TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "StatusReasonInformation8TCH" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -147,39 +160,35 @@ func (v StatusReasonInformation8TCH) Validate() error { // XSD SimpleType validations func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } func (v ProprietaryReasonCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "9946", "9948", "9964", "DS0H", "RC02")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "9946", "9948", "9964", "DS0H", "RC02"); err != nil { + return err } - return errs + return nil } func (v TransactionGroupStatus3CodeAdmin) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACTC", "RJCT")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACTC", "RJCT"); err != nil { + return err } - return errs + return nil } diff --git a/gen/admn_005_001_01/validate.go b/gen/admn_005_001_01/validate.go index 6c2c19b..bd836c2 100644 --- a/gen/admn_005_001_01/validate.go +++ b/gen/admn_005_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AdmnEchoReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AdmnEchoReq", v.AdmnEchoReq.Validate()) if errs.Empty() { return nil } @@ -38,8 +41,9 @@ func (v DocumentTCH) Validate() error { func (v EchoRequest) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.EchoTxInf.Validate()) + baseName := "EchoRequest" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".EchoTxInf", v.EchoTxInf.Validate()) if errs.Empty() { return nil } @@ -48,8 +52,9 @@ func (v EchoRequest) Validate() error { func (v EchoRequestTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.EchoTxInf.Validate()) + baseName := "EchoRequestTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".EchoTxInf", v.EchoTxInf.Validate()) if errs.Empty() { return nil } @@ -58,10 +63,11 @@ func (v EchoRequestTCH) Validate() error { func (v EchoTxInf) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FnctnCd.Validate()) - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "EchoTxInf" + rtp.AddError(&errs, baseName+".FnctnCd", v.FnctnCd.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -70,10 +76,11 @@ func (v EchoTxInf) Validate() error { func (v EchoTxInfTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FnctnCd.Validate()) - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "EchoTxInfTCH" + rtp.AddError(&errs, baseName+".FnctnCd", v.FnctnCd.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -82,7 +89,8 @@ func (v EchoTxInfTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -91,8 +99,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -101,8 +110,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -112,53 +122,57 @@ func (v GrpHdrTCH) Validate() error { // XSD SimpleType validations func (v EchoCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{1,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "731")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{1,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "731"); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } diff --git a/gen/admn_006_001_01/validate.go b/gen/admn_006_001_01/validate.go index 754a178..a2abddb 100644 --- a/gen/admn_006_001_01/validate.go +++ b/gen/admn_006_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,7 +31,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AdmnEchoResp.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AdmnEchoResp", v.AdmnEchoResp.Validate()) if errs.Empty() { return nil } @@ -38,11 +41,12 @@ func (v DocumentTCH) Validate() error { func (v EchoResp) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.FnctnCd.Validate()) - rtp.AddError(&errs, v.TxSts.Validate()) + baseName := "EchoResp" + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".FnctnCd", v.FnctnCd.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if errs.Empty() { return nil } @@ -51,8 +55,9 @@ func (v EchoResp) Validate() error { func (v EchoResponse) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.EchoResponse.Validate()) + baseName := "EchoResponse" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".EchoResponse", v.EchoResponse.Validate()) if errs.Empty() { return nil } @@ -61,8 +66,9 @@ func (v EchoResponse) Validate() error { func (v EchoResponseTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.EchoResponse.Validate()) + baseName := "EchoResponseTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".EchoResponse", v.EchoResponse.Validate()) if errs.Empty() { return nil } @@ -71,7 +77,8 @@ func (v EchoResponseTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -80,8 +87,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -90,8 +98,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -101,51 +110,51 @@ func (v GrpHdrTCH) Validate() error { // XSD SimpleType validations func (v EchoCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{1,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "731")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{1,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "731"); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } func (v TransactionIndividualStatus3CodeEcho) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACTC")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACTC"); err != nil { + return err } - return errs + return nil } diff --git a/gen/admn_007_001_01/validate.go b/gen/admn_007_001_01/validate.go index 8fc0a45..54df5f7 100644 --- a/gen/admn_007_001_01/validate.go +++ b/gen/admn_007_001_01/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -29,10 +31,11 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v DatabaseReportInformation) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RptCd.Validate()) - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "DatabaseReportInformation" + rtp.AddError(&errs, baseName+".RptCd", v.RptCd.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -41,10 +44,11 @@ func (v DatabaseReportInformation) Validate() error { func (v DatabaseReportInformationTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RptCd.Validate()) - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "DatabaseReportInformationTCH" + rtp.AddError(&errs, baseName+".RptCd", v.RptCd.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if errs.Empty() { return nil } @@ -53,8 +57,9 @@ func (v DatabaseReportInformationTCH) Validate() error { func (v DatabaseReportRequest) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.DBRptInf.Validate()) + baseName := "DatabaseReportRequest" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".DBRptInf", v.DBRptInf.Validate()) if errs.Empty() { return nil } @@ -63,8 +68,9 @@ func (v DatabaseReportRequest) Validate() error { func (v DatabaseReportRequestTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.DBRptInf.Validate()) + baseName := "DatabaseReportRequestTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".DBRptInf", v.DBRptInf.Validate()) if errs.Empty() { return nil } @@ -73,7 +79,8 @@ func (v DatabaseReportRequestTCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DBRptReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".DBRptReq", v.DBRptReq.Validate()) if errs.Empty() { return nil } @@ -82,7 +89,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -91,8 +99,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -101,8 +110,9 @@ func (v GrpHdr) Validate() error { func (v GrpHdrTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdrTCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -112,65 +122,73 @@ func (v GrpHdrTCH) Validate() error { // XSD SimpleType validations func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))((([0-1][0-9])|(2[0-3]))(([0-5][0-9])){2})[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } func (v ReportCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AVLBTY")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 6)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AVLBTY"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 6); err != nil { + return err + } + return nil } func (v ReportCodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AVLBTY")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 6)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AVLBTY"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 6); err != nil { + return err + } + return nil } diff --git a/gen/admn_008_001_01/validate.go b/gen/admn_008_001_01/validate.go index 039d232..83d8bc6 100644 --- a/gen/admn_008_001_01/validate.go +++ b/gen/admn_008_001_01/validate.go @@ -11,11 +11,12 @@ import ( func (v AvailabilityParticipant) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AvailabilityParticipant" if v.PtcptSgnOff != nil { - rtp.AddError(&errs, v.PtcptSgnOff.Validate()) + rtp.AddError(&errs, baseName+".PtcptSgnOff", v.PtcptSgnOff.Validate()) } if v.PtcptSspd != nil { - rtp.AddError(&errs, v.PtcptSspd.Validate()) + rtp.AddError(&errs, baseName+".PtcptSspd", v.PtcptSspd.Validate()) } if errs.Empty() { return nil @@ -25,11 +26,12 @@ func (v AvailabilityParticipant) Validate() error { func (v AvailabilityParticipantTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AvailabilityParticipantTCH" if v.PtcptSgnOff != nil { - rtp.AddError(&errs, v.PtcptSgnOff.Validate()) + rtp.AddError(&errs, baseName+".PtcptSgnOff", v.PtcptSgnOff.Validate()) } if v.PtcptSspd != nil { - rtp.AddError(&errs, v.PtcptSspd.Validate()) + rtp.AddError(&errs, baseName+".PtcptSspd", v.PtcptSspd.Validate()) } if errs.Empty() { return nil @@ -39,11 +41,12 @@ func (v AvailabilityParticipantTCH) Validate() error { func (v AvailabilityReport) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AvailabilityReport" if v.Cnnctn != nil { - rtp.AddError(&errs, v.Cnnctn.Validate()) + rtp.AddError(&errs, baseName+".Cnnctn", v.Cnnctn.Validate()) } if v.AvlbtyPtcpt != nil { - rtp.AddError(&errs, v.AvlbtyPtcpt.Validate()) + rtp.AddError(&errs, baseName+".AvlbtyPtcpt", v.AvlbtyPtcpt.Validate()) } if errs.Empty() { return nil @@ -53,11 +56,12 @@ func (v AvailabilityReport) Validate() error { func (v AvailabilityReportTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AvailabilityReportTCH" if v.Cnnctn != nil { - rtp.AddError(&errs, v.Cnnctn.Validate()) + rtp.AddError(&errs, baseName+".Cnnctn", v.Cnnctn.Validate()) } if v.AvlbtyPtcpt != nil { - rtp.AddError(&errs, v.AvlbtyPtcpt.Validate()) + rtp.AddError(&errs, baseName+".AvlbtyPtcpt", v.AvlbtyPtcpt.Validate()) } if errs.Empty() { return nil @@ -67,7 +71,8 @@ func (v AvailabilityReportTCH) Validate() error { func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification4ADMN" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -76,7 +81,8 @@ func (v BranchAndFinancialInstitutionIdentification4ADMN) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -85,8 +91,9 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v Connection) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Connection" for indx := range v.CnnctnId { - rtp.AddError(&errs, v.CnnctnId[indx].Validate()) + rtp.AddError(&errs, baseName+".CnnctnId", v.CnnctnId[indx].Validate()) } if errs.Empty() { return nil @@ -96,8 +103,9 @@ func (v Connection) Validate() error { func (v ConnectionTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ConnectionTCH" for indx := range v.CnnctnId { - rtp.AddError(&errs, v.CnnctnId[indx].Validate()) + rtp.AddError(&errs, baseName+".CnnctnId", v.CnnctnId[indx].Validate()) } if errs.Empty() { return nil @@ -107,9 +115,10 @@ func (v ConnectionTCH) Validate() error { func (v DatabaseAvailabilityReport) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.DBRptRspn.Validate()) - rtp.AddError(&errs, v.AvlbtyRpt.Validate()) + baseName := "DatabaseAvailabilityReport" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".DBRptRspn", v.DBRptRspn.Validate()) + rtp.AddError(&errs, baseName+".AvlbtyRpt", v.AvlbtyRpt.Validate()) if errs.Empty() { return nil } @@ -118,9 +127,10 @@ func (v DatabaseAvailabilityReport) Validate() error { func (v DatabaseAvailabilityReportTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.DBRptRspn.Validate()) - rtp.AddError(&errs, v.AvlbtyRpt.Validate()) + baseName := "DatabaseAvailabilityReportTCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".DBRptRspn", v.DBRptRspn.Validate()) + rtp.AddError(&errs, baseName+".AvlbtyRpt", v.AvlbtyRpt.Validate()) if errs.Empty() { return nil } @@ -129,11 +139,12 @@ func (v DatabaseAvailabilityReportTCH) Validate() error { func (v DatabaseReportReponse) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.RptCd.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.TxSts.Validate()) + baseName := "DatabaseReportReponse" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".RptCd", v.RptCd.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if errs.Empty() { return nil } @@ -142,11 +153,12 @@ func (v DatabaseReportReponse) Validate() error { func (v DatabaseReportReponseTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.RptCd.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.TxSts.Validate()) + baseName := "DatabaseReportReponseTCH" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".RptCd", v.RptCd.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if errs.Empty() { return nil } @@ -155,7 +167,8 @@ func (v DatabaseReportReponseTCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DBAvlbtyRpt.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".DBAvlbtyRpt", v.DBAvlbtyRpt.Validate()) if errs.Empty() { return nil } @@ -164,7 +177,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification7ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification7ADMN" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -173,8 +187,9 @@ func (v FinancialInstitutionIdentification7ADMN) Validate() error { func (v GrpHdr) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GrpHdr" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -183,8 +198,9 @@ func (v GrpHdr) Validate() error { func (v ParticipantSignOff) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ParticipantSignOff" for indx := range v.PtcptId { - rtp.AddError(&errs, v.PtcptId[indx].Validate()) + rtp.AddError(&errs, baseName+".PtcptId", v.PtcptId[indx].Validate()) } if errs.Empty() { return nil @@ -194,8 +210,9 @@ func (v ParticipantSignOff) Validate() error { func (v ParticipantSignOffTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ParticipantSignOffTCH" for indx := range v.PtcptId { - rtp.AddError(&errs, v.PtcptId[indx].Validate()) + rtp.AddError(&errs, baseName+".PtcptId", v.PtcptId[indx].Validate()) } if errs.Empty() { return nil @@ -205,8 +222,9 @@ func (v ParticipantSignOffTCH) Validate() error { func (v ParticipantSuspended) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ParticipantSuspended" for indx := range v.PtcptId { - rtp.AddError(&errs, v.PtcptId[indx].Validate()) + rtp.AddError(&errs, baseName+".PtcptId", v.PtcptId[indx].Validate()) } if errs.Empty() { return nil @@ -216,8 +234,9 @@ func (v ParticipantSuspended) Validate() error { func (v ParticipantSuspendedTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ParticipantSuspendedTCH" for indx := range v.PtcptId { - rtp.AddError(&errs, v.PtcptId[indx].Validate()) + rtp.AddError(&errs, baseName+".PtcptId", v.PtcptId[indx].Validate()) } if errs.Empty() { return nil @@ -228,63 +247,67 @@ func (v ParticipantSuspendedTCH) Validate() error { // XSD SimpleType validations func (v Max20AlphaNumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-zA-Z0-9]{1,20}`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 20)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-zA-Z0-9]{1,20}`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 20); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } func (v ReportCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AVLBTY")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 6)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AVLBTY"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 6); err != nil { + return err + } + return nil } func (v ReportCodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AVLBTY")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 6)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AVLBTY"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 6); err != nil { + return err + } + return nil } func (v TransactionIndividualStatus3CodeEcho) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACTC")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACTC"); err != nil { + return err } - return errs + return nil } diff --git a/gen/camt_026_001_07/validate.go b/gen/camt_026_001_07/validate.go index ce78981..326f58d 100644 --- a/gen/camt_026_001_07/validate.go +++ b/gen/camt_026_001_07/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,7 +23,8 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -31,7 +33,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -40,7 +43,8 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH2" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -49,8 +53,9 @@ func (v BranchAndFinancialInstitutionIdentification6TCH2) Validate() error { func (v Case5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -59,8 +64,9 @@ func (v Case5) Validate() error { func (v Case5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -69,10 +75,11 @@ func (v Case5TCH) Validate() error { func (v CaseAssignment5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -81,10 +88,11 @@ func (v CaseAssignment5) Validate() error { func (v CaseAssignment5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -93,7 +101,8 @@ func (v CaseAssignment5TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -102,7 +111,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -111,7 +121,8 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v ClearingSystemMemberIdentification2TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -120,11 +131,12 @@ func (v ClearingSystemMemberIdentification2TCH2) Validate() error { func (v DateAndDateTime2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DateAndDateTime2Choice" if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.DtTm != nil { - rtp.AddError(&errs, v.DtTm.Validate()) + rtp.AddError(&errs, baseName+".DtTm", v.DtTm.Validate()) } if errs.Empty() { return nil @@ -134,7 +146,8 @@ func (v DateAndDateTime2Choice) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.UblToApply.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".UblToApply", v.UblToApply.Validate()) if errs.Empty() { return nil } @@ -143,7 +156,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -152,7 +166,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -161,7 +176,8 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v FinancialInstitutionIdentification18TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH2" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -170,14 +186,15 @@ func (v FinancialInstitutionIdentification18TCH2) Validate() error { func (v MissingOrIncorrectInformation3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "MissingOrIncorrectInformation3" if v.MssngInf != nil { for indx := range v.MssngInf { - rtp.AddError(&errs, v.MssngInf[indx].Validate()) + rtp.AddError(&errs, baseName+".MssngInf", v.MssngInf[indx].Validate()) } } if v.IncrrctInf != nil { for indx := range v.IncrrctInf { - rtp.AddError(&errs, v.IncrrctInf[indx].Validate()) + rtp.AddError(&errs, baseName+".IncrrctInf", v.IncrrctInf[indx].Validate()) } } if errs.Empty() { @@ -188,11 +205,12 @@ func (v MissingOrIncorrectInformation3) Validate() error { func (v Party40Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40Choice" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -202,8 +220,9 @@ func (v Party40Choice) Validate() error { func (v Party40ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -213,11 +232,12 @@ func (v Party40ChoiceTCH) Validate() error { func (v Party40ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH2" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -227,7 +247,8 @@ func (v Party40ChoiceTCH2) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if errs.Empty() { return nil } @@ -236,7 +257,8 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if errs.Empty() { return nil } @@ -245,9 +267,10 @@ func (v PartyIdentification135TCH) Validate() error { func (v UnableToApplyIncorrect1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Cd.Validate()) + baseName := "UnableToApplyIncorrect1" + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) if v.AddtlIncrrctInf != nil { - rtp.AddError(&errs, v.AddtlIncrrctInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlIncrrctInf", v.AddtlIncrrctInf.Validate()) } if errs.Empty() { return nil @@ -257,8 +280,9 @@ func (v UnableToApplyIncorrect1) Validate() error { func (v UnableToApplyJustification3Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "UnableToApplyJustification3Choice" if v.MssngOrIncrrctInf != nil { - rtp.AddError(&errs, v.MssngOrIncrrctInf.Validate()) + rtp.AddError(&errs, baseName+".MssngOrIncrrctInf", v.MssngOrIncrrctInf.Validate()) } if errs.Empty() { return nil @@ -268,9 +292,10 @@ func (v UnableToApplyJustification3Choice) Validate() error { func (v UnableToApplyMissing1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Cd.Validate()) + baseName := "UnableToApplyMissing1" + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) if v.AddtlMssngInf != nil { - rtp.AddError(&errs, v.AddtlMssngInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlMssngInf", v.AddtlMssngInf.Validate()) } if errs.Empty() { return nil @@ -280,10 +305,11 @@ func (v UnableToApplyMissing1) Validate() error { func (v UnableToApplyV07) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.Undrlyg.Validate()) - rtp.AddError(&errs, v.Justfn.Validate()) + baseName := "UnableToApplyV07" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".Undrlyg", v.Undrlyg.Validate()) + rtp.AddError(&errs, baseName+".Justfn", v.Justfn.Validate()) if errs.Empty() { return nil } @@ -292,10 +318,11 @@ func (v UnableToApplyV07) Validate() error { func (v UnableToApplyV07TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.Undrlyg.Validate()) - rtp.AddError(&errs, v.Justfn.Validate()) + baseName := "UnableToApplyV07TCH" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".Undrlyg", v.Undrlyg.Validate()) + rtp.AddError(&errs, baseName+".Justfn", v.Justfn.Validate()) if errs.Empty() { return nil } @@ -304,9 +331,10 @@ func (v UnableToApplyV07TCH) Validate() error { func (v UnderlyingGroupInformation1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) + baseName := "UnderlyingGroupInformation1" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) if errs.Empty() { return nil } @@ -315,9 +343,10 @@ func (v UnderlyingGroupInformation1) Validate() error { func (v UnderlyingGroupInformation1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) + baseName := "UnderlyingGroupInformation1TCH" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) if errs.Empty() { return nil } @@ -326,9 +355,10 @@ func (v UnderlyingGroupInformation1TCH) Validate() error { func (v UnderlyingGroupInformation1TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) + baseName := "UnderlyingGroupInformation1TCH2" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) if errs.Empty() { return nil } @@ -337,16 +367,17 @@ func (v UnderlyingGroupInformation1TCH2) Validate() error { func (v UnderlyingPaymentInstruction5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlPmtInfId.Validate()) + baseName := "UnderlyingPaymentInstruction5" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInfId", v.OrgnlPmtInfId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlInstdAmt.Validate()) - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstdAmt", v.OrgnlInstdAmt.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) if errs.Empty() { return nil } @@ -355,16 +386,17 @@ func (v UnderlyingPaymentInstruction5) Validate() error { func (v UnderlyingPaymentInstruction5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlPmtInfId.Validate()) + baseName := "UnderlyingPaymentInstruction5TCH" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInfId", v.OrgnlPmtInfId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlInstdAmt.Validate()) - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstdAmt", v.OrgnlInstdAmt.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) if errs.Empty() { return nil } @@ -373,17 +405,18 @@ func (v UnderlyingPaymentInstruction5TCH) Validate() error { func (v UnderlyingPaymentTransaction4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "UnderlyingPaymentTransaction4" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmAmt", v.OrgnlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmDt", v.OrgnlIntrBkSttlmDt.Validate()) if errs.Empty() { return nil } @@ -392,17 +425,18 @@ func (v UnderlyingPaymentTransaction4) Validate() error { func (v UnderlyingPaymentTransaction4TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "UnderlyingPaymentTransaction4TCH" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmAmt", v.OrgnlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmDt", v.OrgnlIntrBkSttlmDt.Validate()) if errs.Empty() { return nil } @@ -411,11 +445,12 @@ func (v UnderlyingPaymentTransaction4TCH) Validate() error { func (v UnderlyingTransaction5Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "UnderlyingTransaction5Choice" if v.Initn != nil { - rtp.AddError(&errs, v.Initn.Validate()) + rtp.AddError(&errs, baseName+".Initn", v.Initn.Validate()) } if v.IntrBk != nil { - rtp.AddError(&errs, v.IntrBk.Validate()) + rtp.AddError(&errs, baseName+".IntrBk", v.IntrBk.Validate()) } if errs.Empty() { return nil @@ -425,11 +460,12 @@ func (v UnderlyingTransaction5Choice) Validate() error { func (v UnderlyingTransaction5ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "UnderlyingTransaction5ChoiceTCH" if v.Initn != nil { - rtp.AddError(&errs, v.Initn.Validate()) + rtp.AddError(&errs, baseName+".Initn", v.Initn.Validate()) } if v.IntrBk != nil { - rtp.AddError(&errs, v.IntrBk.Validate()) + rtp.AddError(&errs, baseName+".IntrBk", v.IntrBk.Validate()) } if errs.Empty() { return nil @@ -440,112 +476,114 @@ func (v UnderlyingTransaction5ChoiceTCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v OrigMsgNameTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v OrigMsgNameTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v UnableToApplyIncorrectInformation4Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "IN01", "IN04", "IN06", "IN15", "IN19", "IN38", "IN39", "MM20", "MM21", "NARR")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "IN01", "IN04", "IN06", "IN15", "IN19", "IN38", "IN39", "MM20", "MM21", "NARR"); err != nil { + return err } - return errs + return nil } func (v UnableToApplyMissingInformation3Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "MS01", "NARR")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "MS01", "NARR"); err != nil { + return err } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/camt_028_001_09/validate.go b/gen/camt_028_001_09/validate.go index 5cbabae..0f4694b 100644 --- a/gen/camt_028_001_09/validate.go +++ b/gen/camt_028_001_09/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,10 +23,11 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v AdditionalPaymentInformationV09) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.Undrlyg.Validate()) - rtp.AddError(&errs, v.Inf.Validate()) + baseName := "AdditionalPaymentInformationV09" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".Undrlyg", v.Undrlyg.Validate()) + rtp.AddError(&errs, baseName+".Inf", v.Inf.Validate()) if errs.Empty() { return nil } @@ -34,10 +36,11 @@ func (v AdditionalPaymentInformationV09) Validate() error { func (v AdditionalPaymentInformationV09TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.Undrlyg.Validate()) - rtp.AddError(&errs, v.Inf.Validate()) + baseName := "AdditionalPaymentInformationV09TCH" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".Undrlyg", v.Undrlyg.Validate()) + rtp.AddError(&errs, baseName+".Inf", v.Inf.Validate()) if errs.Empty() { return nil } @@ -46,7 +49,8 @@ func (v AdditionalPaymentInformationV09TCH) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -55,7 +59,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -64,8 +69,9 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v Case5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -74,8 +80,9 @@ func (v Case5) Validate() error { func (v Case5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -84,10 +91,11 @@ func (v Case5TCH) Validate() error { func (v CaseAssignment5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -96,10 +104,11 @@ func (v CaseAssignment5) Validate() error { func (v CaseAssignment5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -108,7 +117,8 @@ func (v CaseAssignment5TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -117,7 +127,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -126,8 +137,9 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v Contact4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Contact4" if v.PhneNb != nil { - rtp.AddError(&errs, v.PhneNb.Validate()) + rtp.AddError(&errs, baseName+".PhneNb", v.PhneNb.Validate()) } if errs.Empty() { return nil @@ -137,11 +149,12 @@ func (v Contact4) Validate() error { func (v DateAndDateTime2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DateAndDateTime2Choice" if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.DtTm != nil { - rtp.AddError(&errs, v.DtTm.Validate()) + rtp.AddError(&errs, baseName+".DtTm", v.DtTm.Validate()) } if errs.Empty() { return nil @@ -151,9 +164,10 @@ func (v DateAndDateTime2Choice) Validate() error { func (v DateAndPlaceOfBirth1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.BirthDt.Validate()) - rtp.AddError(&errs, v.CityOfBirth.Validate()) - rtp.AddError(&errs, v.CtryOfBirth.Validate()) + baseName := "DateAndPlaceOfBirth1" + rtp.AddError(&errs, baseName+".BirthDt", v.BirthDt.Validate()) + rtp.AddError(&errs, baseName+".CityOfBirth", v.CityOfBirth.Validate()) + rtp.AddError(&errs, baseName+".CtryOfBirth", v.CtryOfBirth.Validate()) if errs.Empty() { return nil } @@ -162,8 +176,9 @@ func (v DateAndPlaceOfBirth1) Validate() error { func (v DiscountAmountAndType1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DiscountAmountAndType1" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -172,8 +187,9 @@ func (v DiscountAmountAndType1) Validate() error { func (v DiscountAmountAndType1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DiscountAmountAndType1TCH" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -182,8 +198,9 @@ func (v DiscountAmountAndType1TCH) Validate() error { func (v DiscountAmountType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -193,8 +210,9 @@ func (v DiscountAmountType1Choice) Validate() error { func (v DiscountAmountType1ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1ChoiceTCH" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -204,7 +222,8 @@ func (v DiscountAmountType1ChoiceTCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AddtlPmtInf.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".AddtlPmtInf", v.AddtlPmtInf.Validate()) if errs.Empty() { return nil } @@ -213,7 +232,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -222,7 +242,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -231,9 +252,10 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v GenericPersonIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericPersonIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -243,8 +265,9 @@ func (v GenericPersonIdentification1) Validate() error { func (v OrganisationIdentification29) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if errs.Empty() { return nil @@ -254,7 +277,8 @@ func (v OrganisationIdentification29) Validate() error { func (v OrganisationIdentification29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.LEI.Validate()) + baseName := "OrganisationIdentification29TCH" + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) if errs.Empty() { return nil } @@ -263,12 +287,13 @@ func (v OrganisationIdentification29TCH) Validate() error { func (v OrganisationIdentification30) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification30" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -279,12 +304,13 @@ func (v OrganisationIdentification30) Validate() error { func (v OrganisationIdentification30TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification30TCH" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -295,9 +321,10 @@ func (v OrganisationIdentification30TCH) Validate() error { func (v GenericOrganisationIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -307,9 +334,10 @@ func (v GenericOrganisationIdentification1) Validate() error { func (v GenericOrganisationIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -319,8 +347,9 @@ func (v GenericOrganisationIdentification1TCH) Validate() error { func (v OrganisationIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentificationSchemeName1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -330,8 +359,9 @@ func (v OrganisationIdentificationSchemeName1Choice) Validate() error { func (v OrganisationIdentificationSchemeName1ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentificationSchemeName1ChoiceTCH" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -341,8 +371,9 @@ func (v OrganisationIdentificationSchemeName1ChoiceTCH) Validate() error { func (v PersonIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentificationSchemeName1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -352,11 +383,12 @@ func (v PersonIdentificationSchemeName1Choice) Validate() error { func (v Party38Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38Choice" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -366,11 +398,12 @@ func (v Party38Choice) Validate() error { func (v Party38ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -380,11 +413,12 @@ func (v Party38ChoiceTCH) Validate() error { func (v Party38ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH2" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -394,11 +428,12 @@ func (v Party38ChoiceTCH2) Validate() error { func (v Party38ChoiceTCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH3" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -408,11 +443,12 @@ func (v Party38ChoiceTCH3) Validate() error { func (v Party38ChoiceTCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH4" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -422,11 +458,12 @@ func (v Party38ChoiceTCH4) Validate() error { func (v Party40Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40Choice" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -436,8 +473,9 @@ func (v Party40Choice) Validate() error { func (v Party40ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -447,11 +485,12 @@ func (v Party40ChoiceTCH) Validate() error { func (v Party40ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH2" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -461,17 +500,18 @@ func (v Party40ChoiceTCH2) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -481,7 +521,8 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if errs.Empty() { return nil } @@ -490,14 +531,15 @@ func (v PartyIdentification135TCH) Validate() error { func (v PartyIdentification135TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH2" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -507,14 +549,15 @@ func (v PartyIdentification135TCH2) Validate() error { func (v PartyIdentification135TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH3" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -524,17 +567,18 @@ func (v PartyIdentification135TCH3) Validate() error { func (v PartyIdentification135TCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH4" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -544,14 +588,15 @@ func (v PartyIdentification135TCH4) Validate() error { func (v PartyIdentification135TCH5) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH5" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -561,29 +606,30 @@ func (v PartyIdentification135TCH5) Validate() error { func (v PaymentComplementaryInformation8) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentComplementaryInformation8" if v.InstrId != nil { - rtp.AddError(&errs, v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) } if v.EndToEndId != nil { - rtp.AddError(&errs, v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) } if v.TxId != nil { - rtp.AddError(&errs, v.TxId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) } if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if v.UltmtCdtr != nil { - rtp.AddError(&errs, v.UltmtCdtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtCdtr", v.UltmtCdtr.Validate()) } if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -593,29 +639,30 @@ func (v PaymentComplementaryInformation8) Validate() error { func (v PaymentComplementaryInformation8TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentComplementaryInformation8TCH" if v.InstrId != nil { - rtp.AddError(&errs, v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) } if v.EndToEndId != nil { - rtp.AddError(&errs, v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) } if v.TxId != nil { - rtp.AddError(&errs, v.TxId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) } if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if v.UltmtCdtr != nil { - rtp.AddError(&errs, v.UltmtCdtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtCdtr", v.UltmtCdtr.Validate()) } if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -625,12 +672,13 @@ func (v PaymentComplementaryInformation8TCH) Validate() error { func (v PersonIdentification13) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -641,12 +689,13 @@ func (v PersonIdentification13) Validate() error { func (v PersonIdentification13TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13TCH" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -657,7 +706,8 @@ func (v PersonIdentification13TCH) Validate() error { func (v PersonIdentification13TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13TCH2" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -666,7 +716,8 @@ func (v PersonIdentification13TCH2) Validate() error { func (v PersonIdentification13TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Othr.Validate()) + baseName := "PersonIdentification13TCH3" + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) if errs.Empty() { return nil } @@ -675,16 +726,17 @@ func (v PersonIdentification13TCH3) Validate() error { func (v PostalAddress24) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -694,16 +746,17 @@ func (v PostalAddress24) Validate() error { func (v PostalAddress24TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24TCH" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -713,9 +766,10 @@ func (v PostalAddress24TCH) Validate() error { func (v RemittanceAmount2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2" if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if errs.Empty() { @@ -726,9 +780,10 @@ func (v RemittanceAmount2) Validate() error { func (v RemittanceAmount2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2TCH" if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if errs.Empty() { @@ -739,13 +794,14 @@ func (v RemittanceAmount2TCH) Validate() error { func (v RemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation16" if v.Ustrd != nil { for indx := range v.Ustrd { - rtp.AddError(&errs, v.Ustrd[indx].Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd[indx].Validate()) } } if v.Strd != nil { - rtp.AddError(&errs, v.Strd.Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd.Validate()) } if errs.Empty() { return nil @@ -755,13 +811,14 @@ func (v RemittanceInformation16) Validate() error { func (v RemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation16TCH" if v.Ustrd != nil { for indx := range v.Ustrd { - rtp.AddError(&errs, v.Ustrd[indx].Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd[indx].Validate()) } } if v.Strd != nil { - rtp.AddError(&errs, v.Strd.Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd.Validate()) } if errs.Empty() { return nil @@ -771,8 +828,9 @@ func (v RemittanceInformation16TCH) Validate() error { func (v StructuredRemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16" if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if errs.Empty() { return nil @@ -782,8 +840,9 @@ func (v StructuredRemittanceInformation16) Validate() error { func (v StructuredRemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16TCH" if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if errs.Empty() { return nil @@ -793,8 +852,9 @@ func (v StructuredRemittanceInformation16TCH) Validate() error { func (v UnderlyingGroupInformation1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) + baseName := "UnderlyingGroupInformation1" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) if errs.Empty() { return nil } @@ -803,8 +863,9 @@ func (v UnderlyingGroupInformation1) Validate() error { func (v UnderlyingGroupInformation1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) + baseName := "UnderlyingGroupInformation1TCH" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) if errs.Empty() { return nil } @@ -813,8 +874,9 @@ func (v UnderlyingGroupInformation1TCH) Validate() error { func (v UnderlyingGroupInformation1TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) + baseName := "UnderlyingGroupInformation1TCH2" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) if errs.Empty() { return nil } @@ -823,17 +885,18 @@ func (v UnderlyingGroupInformation1TCH2) Validate() error { func (v UnderlyingPaymentInstruction5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlPmtInfId.Validate()) + baseName := "UnderlyingPaymentInstruction5" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInfId", v.OrgnlPmtInfId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlInstdAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstdAmt", v.OrgnlInstdAmt.Validate()) if v.ReqdExctnDt != nil { - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) } if errs.Empty() { return nil @@ -843,17 +906,18 @@ func (v UnderlyingPaymentInstruction5) Validate() error { func (v UnderlyingPaymentInstruction5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlPmtInfId.Validate()) + baseName := "UnderlyingPaymentInstruction5TCH" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInfId", v.OrgnlPmtInfId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlInstdAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstdAmt", v.OrgnlInstdAmt.Validate()) if v.ReqdExctnDt != nil { - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) } if errs.Empty() { return nil @@ -863,17 +927,18 @@ func (v UnderlyingPaymentInstruction5TCH) Validate() error { func (v UnderlyingPaymentTransaction4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "UnderlyingPaymentTransaction4" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmAmt", v.OrgnlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmDt", v.OrgnlIntrBkSttlmDt.Validate()) if errs.Empty() { return nil } @@ -882,17 +947,18 @@ func (v UnderlyingPaymentTransaction4) Validate() error { func (v UnderlyingPaymentTransaction4TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "UnderlyingPaymentTransaction4TCH" + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmAmt", v.OrgnlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmDt", v.OrgnlIntrBkSttlmDt.Validate()) if errs.Empty() { return nil } @@ -901,11 +967,12 @@ func (v UnderlyingPaymentTransaction4TCH) Validate() error { func (v UnderlyingTransaction5Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "UnderlyingTransaction5Choice" if v.Initn != nil { - rtp.AddError(&errs, v.Initn.Validate()) + rtp.AddError(&errs, baseName+".Initn", v.Initn.Validate()) } if v.IntrBk != nil { - rtp.AddError(&errs, v.IntrBk.Validate()) + rtp.AddError(&errs, baseName+".IntrBk", v.IntrBk.Validate()) } if errs.Empty() { return nil @@ -915,11 +982,12 @@ func (v UnderlyingTransaction5Choice) Validate() error { func (v UnderlyingTransaction5ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "UnderlyingTransaction5ChoiceTCH" if v.Initn != nil { - rtp.AddError(&errs, v.Initn.Validate()) + rtp.AddError(&errs, baseName+".Initn", v.Initn.Validate()) } if v.IntrBk != nil { - rtp.AddError(&errs, v.IntrBk.Validate()) + rtp.AddError(&errs, baseName+".IntrBk", v.IntrBk.Validate()) } if errs.Empty() { return nil @@ -930,153 +998,157 @@ func (v UnderlyingTransaction5ChoiceTCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v CountryCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{2,2}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{2,2}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"); err != nil { + return err + } + return nil } func (v LEIIdentifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`); err != nil { + return err } - return errs + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max16Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 16)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 16); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v Max35TextTCH3) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "DSCT", "FULL", "ORIG")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "DSCT", "FULL", "ORIG"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max70Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 70)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 70); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v OrigMsgNameTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v OrigMsgNameTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v PhoneNumber) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`); err != nil { + return err } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/camt_029_001_09/validate.go b/gen/camt_029_001_09/validate.go index a22e023..7fc2834 100644 --- a/gen/camt_029_001_09/validate.go +++ b/gen/camt_029_001_09/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,7 +23,8 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -31,7 +33,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -40,8 +43,9 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v CancellationStatusReason3Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CancellationStatusReason3Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -51,8 +55,9 @@ func (v CancellationStatusReason3Choice) Validate() error { func (v CancellationStatusReason3ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CancellationStatusReason3ChoiceTCH" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -62,7 +67,8 @@ func (v CancellationStatusReason3ChoiceTCH) Validate() error { func (v CancellationStatusReason4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "CancellationStatusReason4" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -71,7 +77,8 @@ func (v CancellationStatusReason4) Validate() error { func (v CancellationStatusReason4TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "CancellationStatusReason4TCH" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if errs.Empty() { return nil } @@ -80,8 +87,9 @@ func (v CancellationStatusReason4TCH) Validate() error { func (v Case5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -90,8 +98,9 @@ func (v Case5) Validate() error { func (v Case5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -100,10 +109,11 @@ func (v Case5TCH) Validate() error { func (v CaseAssignment5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -112,10 +122,11 @@ func (v CaseAssignment5) Validate() error { func (v CaseAssignment5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -124,8 +135,9 @@ func (v CaseAssignment5TCH) Validate() error { func (v Charges7) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Amt.Validate()) - rtp.AddError(&errs, v.Agt.Validate()) + baseName := "Charges7" + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) if errs.Empty() { return nil } @@ -134,8 +146,9 @@ func (v Charges7) Validate() error { func (v Charges7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Amt.Validate()) - rtp.AddError(&errs, v.Agt.Validate()) + baseName := "Charges7TCH" + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) if errs.Empty() { return nil } @@ -144,7 +157,8 @@ func (v Charges7TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -153,7 +167,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -162,7 +177,8 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RsltnOfInvstgtn.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".RsltnOfInvstgtn", v.RsltnOfInvstgtn.Validate()) if errs.Empty() { return nil } @@ -171,7 +187,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -180,7 +197,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -189,8 +207,9 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v InvestigationStatus5Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "InvestigationStatus5Choice" if v.Conf != nil { - rtp.AddError(&errs, v.Conf.Validate()) + rtp.AddError(&errs, baseName+".Conf", v.Conf.Validate()) } if errs.Empty() { return nil @@ -200,12 +219,13 @@ func (v InvestigationStatus5Choice) Validate() error { func (v OriginalGroupHeader14) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RslvdCase.Validate()) - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) + baseName := "OriginalGroupHeader14" + rtp.AddError(&errs, baseName+".RslvdCase", v.RslvdCase.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) if v.CxlStsRsnInf != nil { - rtp.AddError(&errs, v.CxlStsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".CxlStsRsnInf", v.CxlStsRsnInf.Validate()) } if errs.Empty() { return nil @@ -215,12 +235,13 @@ func (v OriginalGroupHeader14) Validate() error { func (v OriginalGroupHeader14TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RslvdCase.Validate()) - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) + baseName := "OriginalGroupHeader14TCH" + rtp.AddError(&errs, baseName+".RslvdCase", v.RslvdCase.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) if v.CxlStsRsnInf != nil { - rtp.AddError(&errs, v.CxlStsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".CxlStsRsnInf", v.CxlStsRsnInf.Validate()) } if errs.Empty() { return nil @@ -230,8 +251,9 @@ func (v OriginalGroupHeader14TCH) Validate() error { func (v Party40Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40Choice" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -241,8 +263,9 @@ func (v Party40Choice) Validate() error { func (v Party40ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -252,14 +275,15 @@ func (v Party40ChoiceTCH) Validate() error { func (v PaymentTransaction102) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentTransaction102" if v.CxlStsId != nil { - rtp.AddError(&errs, v.CxlStsId.Validate()) + rtp.AddError(&errs, baseName+".CxlStsId", v.CxlStsId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } if v.RsltnRltdInf != nil { - rtp.AddError(&errs, v.RsltnRltdInf.Validate()) + rtp.AddError(&errs, baseName+".RsltnRltdInf", v.RsltnRltdInf.Validate()) } if errs.Empty() { return nil @@ -269,14 +293,15 @@ func (v PaymentTransaction102) Validate() error { func (v PaymentTransaction102TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentTransaction102TCH" if v.CxlStsId != nil { - rtp.AddError(&errs, v.CxlStsId.Validate()) + rtp.AddError(&errs, baseName+".CxlStsId", v.CxlStsId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } if v.RsltnRltdInf != nil { - rtp.AddError(&errs, v.RsltnRltdInf.Validate()) + rtp.AddError(&errs, baseName+".RsltnRltdInf", v.RsltnRltdInf.Validate()) } if errs.Empty() { return nil @@ -286,15 +311,16 @@ func (v PaymentTransaction102TCH) Validate() error { func (v ResolutionData1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) + baseName := "ResolutionData1" + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) if v.IntrBkSttlmDt != nil { - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) } if v.ClrChanl != nil { - rtp.AddError(&errs, v.ClrChanl.Validate()) + rtp.AddError(&errs, baseName+".ClrChanl", v.ClrChanl.Validate()) } if v.Chrgs != nil { - rtp.AddError(&errs, v.Chrgs.Validate()) + rtp.AddError(&errs, baseName+".Chrgs", v.Chrgs.Validate()) } if errs.Empty() { return nil @@ -304,15 +330,16 @@ func (v ResolutionData1) Validate() error { func (v ResolutionData1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) + baseName := "ResolutionData1TCH" + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) if v.IntrBkSttlmDt != nil { - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) } if v.ClrChanl != nil { - rtp.AddError(&errs, v.ClrChanl.Validate()) + rtp.AddError(&errs, baseName+".ClrChanl", v.ClrChanl.Validate()) } if v.Chrgs != nil { - rtp.AddError(&errs, v.Chrgs.Validate()) + rtp.AddError(&errs, baseName+".Chrgs", v.Chrgs.Validate()) } if errs.Empty() { return nil @@ -322,9 +349,10 @@ func (v ResolutionData1TCH) Validate() error { func (v ResolutionOfInvestigationV09) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Sts.Validate()) - rtp.AddError(&errs, v.CxlDtls.Validate()) + baseName := "ResolutionOfInvestigationV09" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Sts", v.Sts.Validate()) + rtp.AddError(&errs, baseName+".CxlDtls", v.CxlDtls.Validate()) if errs.Empty() { return nil } @@ -333,9 +361,10 @@ func (v ResolutionOfInvestigationV09) Validate() error { func (v ResolutionOfInvestigationV09TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Sts.Validate()) - rtp.AddError(&errs, v.CxlDtls.Validate()) + baseName := "ResolutionOfInvestigationV09TCH" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Sts", v.Sts.Validate()) + rtp.AddError(&errs, baseName+".CxlDtls", v.CxlDtls.Validate()) if errs.Empty() { return nil } @@ -344,9 +373,10 @@ func (v ResolutionOfInvestigationV09TCH) Validate() error { func (v UnderlyingTransaction22) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInfAndSts.Validate()) + baseName := "UnderlyingTransaction22" + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndSts", v.OrgnlGrpInfAndSts.Validate()) if v.TxInfAndSts != nil { - rtp.AddError(&errs, v.TxInfAndSts.Validate()) + rtp.AddError(&errs, baseName+".TxInfAndSts", v.TxInfAndSts.Validate()) } if errs.Empty() { return nil @@ -356,9 +386,10 @@ func (v UnderlyingTransaction22) Validate() error { func (v UnderlyingTransaction22TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInfAndSts.Validate()) + baseName := "UnderlyingTransaction22TCH" + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndSts", v.OrgnlGrpInfAndSts.Validate()) if v.TxInfAndSts != nil { - rtp.AddError(&errs, v.TxInfAndSts.Validate()) + rtp.AddError(&errs, baseName+".TxInfAndSts", v.TxInfAndSts.Validate()) } if errs.Empty() { return nil @@ -369,104 +400,110 @@ func (v UnderlyingTransaction22TCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v ClearingChannel2Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "MPNS", "RTGS", "RTNS")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "MPNS", "RTGS", "RTNS"); err != nil { + return err } - return errs + return nil } func (v ExternalInvestigationExecutionConfirmation1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "IPAY", "PECR", "RJCR")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "IPAY", "PECR", "RJCR"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalPaymentCancellationRejection1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AC04", "AM04", "ARDT", "CUST", "LEGL", "NOAS", "NOOR")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AC04", "AM04", "ARDT", "CUST", "LEGL", "NOAS", "NOOR"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalPaymentCancellationRejection1CodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AC04", "AM04", "ARDT", "CUST", "LEGL", "NOAS", "NOOR")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AC04", "AM04", "ARDT", "CUST", "LEGL", "NOAS", "NOOR"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "camt.056.001.05", "camt.056.001.08")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "camt.056.001.05", "camt.056.001.08"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/camt_035_001_05/validate.go b/gen/camt_035_001_05/validate.go index 63beea0..55d1412 100644 --- a/gen/camt_035_001_05/validate.go +++ b/gen/camt_035_001_05/validate.go @@ -11,7 +11,8 @@ import ( func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -20,7 +21,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -29,8 +31,9 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v Case5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -39,8 +42,9 @@ func (v Case5) Validate() error { func (v Case5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -49,10 +53,11 @@ func (v Case5TCH) Validate() error { func (v CaseAssignment5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -61,10 +66,11 @@ func (v CaseAssignment5) Validate() error { func (v CaseAssignment5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -73,7 +79,8 @@ func (v CaseAssignment5TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -82,7 +89,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -91,7 +99,8 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PrtryFrmtInvstgtn.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".PrtryFrmtInvstgtn", v.PrtryFrmtInvstgtn.Validate()) if errs.Empty() { return nil } @@ -100,7 +109,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -109,7 +119,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -118,11 +129,12 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v Party40Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40Choice" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -132,8 +144,9 @@ func (v Party40Choice) Validate() error { func (v Party40ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -143,11 +156,12 @@ func (v Party40ChoiceTCH) Validate() error { func (v Party40ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH2" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -157,7 +171,8 @@ func (v Party40ChoiceTCH2) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if errs.Empty() { return nil } @@ -166,7 +181,8 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if errs.Empty() { return nil } @@ -175,10 +191,11 @@ func (v PartyIdentification135TCH) Validate() error { func (v ProprietaryData6Reduced) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ProprietaryData6Reduced" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } - rtp.AddError(&errs, v.OrigRefs.Validate()) + rtp.AddError(&errs, baseName+".OrigRefs", v.OrigRefs.Validate()) if errs.Empty() { return nil } @@ -187,10 +204,11 @@ func (v ProprietaryData6Reduced) Validate() error { func (v ProprietaryData6ReducedTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ProprietaryData6ReducedTCH" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } - rtp.AddError(&errs, v.OrigRefs.Validate()) + rtp.AddError(&errs, baseName+".OrigRefs", v.OrigRefs.Validate()) if errs.Empty() { return nil } @@ -199,8 +217,9 @@ func (v ProprietaryData6ReducedTCH) Validate() error { func (v ProprietaryData7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Data.Validate()) + baseName := "ProprietaryData7TCH" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Data", v.Data.Validate()) if errs.Empty() { return nil } @@ -209,8 +228,9 @@ func (v ProprietaryData7TCH) Validate() error { func (v ProprietaryData7TCHTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Data.Validate()) + baseName := "ProprietaryData7TCHTCH" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Data", v.Data.Validate()) if errs.Empty() { return nil } @@ -219,9 +239,10 @@ func (v ProprietaryData7TCHTCH) Validate() error { func (v ProprietaryFormatInvestigationV05) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.PrtryData.Validate()) + baseName := "ProprietaryFormatInvestigationV05" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".PrtryData", v.PrtryData.Validate()) if errs.Empty() { return nil } @@ -230,9 +251,10 @@ func (v ProprietaryFormatInvestigationV05) Validate() error { func (v ProprietaryFormatInvestigationV05TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.PrtryData.Validate()) + baseName := "ProprietaryFormatInvestigationV05TCH" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".PrtryData", v.PrtryData.Validate()) if errs.Empty() { return nil } @@ -241,11 +263,12 @@ func (v ProprietaryFormatInvestigationV05TCH) Validate() error { func (v TransactionReferences8Reduced) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "TransactionReferences8Reduced" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if v.UETR != nil { - rtp.AddError(&errs, v.UETR.Validate()) + rtp.AddError(&errs, baseName+".UETR", v.UETR.Validate()) } if errs.Empty() { return nil @@ -255,11 +278,12 @@ func (v TransactionReferences8Reduced) Validate() error { func (v TransactionReferences8ReducedTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "TransactionReferences8ReducedTCH" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if v.UETR != nil { - rtp.AddError(&errs, v.UETR.Validate()) + rtp.AddError(&errs, baseName+".UETR", v.UETR.Validate()) } if errs.Empty() { return nil @@ -270,62 +294,64 @@ func (v TransactionReferences8ReducedTCH) Validate() error { // XSD SimpleType validations func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v Max35TextTCH3) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACK", "ACWP")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACK", "ACWP"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/camt_056_001_08/validate.go b/gen/camt_056_001_08/validate.go index 194a7d6..77fcd60 100644 --- a/gen/camt_056_001_08/validate.go +++ b/gen/camt_056_001_08/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,7 +23,8 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -31,7 +33,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -40,11 +43,12 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v CancellationReason33Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CancellationReason33Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -54,11 +58,12 @@ func (v CancellationReason33Choice) Validate() error { func (v CancellationReason33ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CancellationReason33ChoiceTCH" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -68,8 +73,9 @@ func (v CancellationReason33ChoiceTCH) Validate() error { func (v Case5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -78,8 +84,9 @@ func (v Case5) Validate() error { func (v Case5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Cretr.Validate()) + baseName := "Case5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Cretr", v.Cretr.Validate()) if errs.Empty() { return nil } @@ -88,10 +95,11 @@ func (v Case5TCH) Validate() error { func (v CaseAssignment5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -100,10 +108,11 @@ func (v CaseAssignment5) Validate() error { func (v CaseAssignment5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) - rtp.AddError(&errs, v.Assgnr.Validate()) - rtp.AddError(&errs, v.Assgne.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "CaseAssignment5TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) + rtp.AddError(&errs, baseName+".Assgnr", v.Assgnr.Validate()) + rtp.AddError(&errs, baseName+".Assgne", v.Assgne.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -112,7 +121,8 @@ func (v CaseAssignment5TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -121,7 +131,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -130,8 +141,9 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v Contact4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Contact4" if v.PhneNb != nil { - rtp.AddError(&errs, v.PhneNb.Validate()) + rtp.AddError(&errs, baseName+".PhneNb", v.PhneNb.Validate()) } if errs.Empty() { return nil @@ -141,9 +153,10 @@ func (v Contact4) Validate() error { func (v DateAndPlaceOfBirth1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.BirthDt.Validate()) - rtp.AddError(&errs, v.CityOfBirth.Validate()) - rtp.AddError(&errs, v.CtryOfBirth.Validate()) + baseName := "DateAndPlaceOfBirth1" + rtp.AddError(&errs, baseName+".BirthDt", v.BirthDt.Validate()) + rtp.AddError(&errs, baseName+".CityOfBirth", v.CityOfBirth.Validate()) + rtp.AddError(&errs, baseName+".CtryOfBirth", v.CtryOfBirth.Validate()) if errs.Empty() { return nil } @@ -152,7 +165,8 @@ func (v DateAndPlaceOfBirth1) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FIToFIPmtCxlReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".FIToFIPmtCxlReq", v.FIToFIPmtCxlReq.Validate()) if errs.Empty() { return nil } @@ -161,7 +175,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -170,7 +185,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -179,9 +195,10 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v FIToFIPaymentCancellationRequestV08) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.Undrlyg.Validate()) + baseName := "FIToFIPaymentCancellationRequestV08" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".Undrlyg", v.Undrlyg.Validate()) if errs.Empty() { return nil } @@ -190,9 +207,10 @@ func (v FIToFIPaymentCancellationRequestV08) Validate() error { func (v FIToFIPaymentCancellationRequestV08TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Assgnmt.Validate()) - rtp.AddError(&errs, v.Case.Validate()) - rtp.AddError(&errs, v.Undrlyg.Validate()) + baseName := "FIToFIPaymentCancellationRequestV08TCH" + rtp.AddError(&errs, baseName+".Assgnmt", v.Assgnmt.Validate()) + rtp.AddError(&errs, baseName+".Case", v.Case.Validate()) + rtp.AddError(&errs, baseName+".Undrlyg", v.Undrlyg.Validate()) if errs.Empty() { return nil } @@ -201,7 +219,8 @@ func (v FIToFIPaymentCancellationRequestV08TCH) Validate() error { func (v GenericOrganisationIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -210,7 +229,8 @@ func (v GenericOrganisationIdentification1) Validate() error { func (v GenericOrganisationIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -219,11 +239,12 @@ func (v GenericOrganisationIdentification1TCH) Validate() error { func (v OrganisationIdentification29) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -233,7 +254,8 @@ func (v OrganisationIdentification29) Validate() error { func (v OrganisationIdentification29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Othr.Validate()) + baseName := "OrganisationIdentification29TCH" + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) if errs.Empty() { return nil } @@ -242,7 +264,8 @@ func (v OrganisationIdentification29TCH) Validate() error { func (v OrganisationIdentification29TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.LEI.Validate()) + baseName := "OrganisationIdentification29TCH2" + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) if errs.Empty() { return nil } @@ -251,10 +274,11 @@ func (v OrganisationIdentification29TCH2) Validate() error { func (v OriginalGroupHeader15) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) + baseName := "OriginalGroupHeader15" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) if v.OrgnlCreDtTm != nil { - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) } if errs.Empty() { return nil @@ -264,11 +288,12 @@ func (v OriginalGroupHeader15) Validate() error { func (v OriginalTransactionReference28) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OriginalTransactionReference28" if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if errs.Empty() { return nil @@ -278,11 +303,12 @@ func (v OriginalTransactionReference28) Validate() error { func (v OriginalTransactionReference28TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OriginalTransactionReference28TCH" if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if errs.Empty() { return nil @@ -292,11 +318,12 @@ func (v OriginalTransactionReference28TCH) Validate() error { func (v Party38Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38Choice" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -306,8 +333,9 @@ func (v Party38Choice) Validate() error { func (v Party38ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -317,11 +345,12 @@ func (v Party38ChoiceTCH) Validate() error { func (v Party38ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH2" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -331,11 +360,12 @@ func (v Party38ChoiceTCH2) Validate() error { func (v Party40Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40Choice" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -345,8 +375,9 @@ func (v Party40Choice) Validate() error { func (v Party40ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH" if v.Agt != nil { - rtp.AddError(&errs, v.Agt.Validate()) + rtp.AddError(&errs, baseName+".Agt", v.Agt.Validate()) } if errs.Empty() { return nil @@ -356,8 +387,9 @@ func (v Party40ChoiceTCH) Validate() error { func (v Party40ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH2" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if errs.Empty() { return nil @@ -367,8 +399,9 @@ func (v Party40ChoiceTCH2) Validate() error { func (v Party40ChoiceTCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party40ChoiceTCH3" if v.Pty != nil { - rtp.AddError(&errs, v.Pty.Validate()) + rtp.AddError(&errs, baseName+".Pty", v.Pty.Validate()) } if errs.Empty() { return nil @@ -378,17 +411,18 @@ func (v Party40ChoiceTCH3) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -398,11 +432,12 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -412,12 +447,13 @@ func (v PartyIdentification135TCH) Validate() error { func (v PartyIdentification135TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH2" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -427,15 +463,16 @@ func (v PartyIdentification135TCH2) Validate() error { func (v PartyIdentification135TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH3" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -445,12 +482,13 @@ func (v PartyIdentification135TCH3) Validate() error { func (v PaymentCancellationReason5) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentCancellationReason5" if v.Orgtr != nil { - rtp.AddError(&errs, v.Orgtr.Validate()) + rtp.AddError(&errs, baseName+".Orgtr", v.Orgtr.Validate()) } - rtp.AddError(&errs, v.Rsn.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -460,12 +498,13 @@ func (v PaymentCancellationReason5) Validate() error { func (v PaymentCancellationReason5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentCancellationReason5TCH" if v.Orgtr != nil { - rtp.AddError(&errs, v.Orgtr.Validate()) + rtp.AddError(&errs, baseName+".Orgtr", v.Orgtr.Validate()) } - rtp.AddError(&errs, v.Rsn.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -475,20 +514,21 @@ func (v PaymentCancellationReason5TCH) Validate() error { func (v PaymentTransaction106) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "PaymentTransaction106" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlClrSysRef.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmDt.Validate()) - rtp.AddError(&errs, v.CxlRsnInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlClrSysRef", v.OrgnlClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmAmt", v.OrgnlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmDt", v.OrgnlIntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".CxlRsnInf", v.CxlRsnInf.Validate()) if v.OrgnlTxRef != nil { - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) } if errs.Empty() { return nil @@ -498,20 +538,21 @@ func (v PaymentTransaction106) Validate() error { func (v PaymentTransaction106TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "PaymentTransaction106TCH" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.OrgnlClrSysRef.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.OrgnlIntrBkSttlmDt.Validate()) - rtp.AddError(&errs, v.CxlRsnInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlClrSysRef", v.OrgnlClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmAmt", v.OrgnlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlIntrBkSttlmDt", v.OrgnlIntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".CxlRsnInf", v.CxlRsnInf.Validate()) if v.OrgnlTxRef != nil { - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) } if errs.Empty() { return nil @@ -521,7 +562,8 @@ func (v PaymentTransaction106TCH) Validate() error { func (v PersonIdentification13) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -530,7 +572,8 @@ func (v PersonIdentification13) Validate() error { func (v PersonIdentification13TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13TCH" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -539,16 +582,17 @@ func (v PersonIdentification13TCH) Validate() error { func (v PostalAddress24) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -558,16 +602,17 @@ func (v PostalAddress24) Validate() error { func (v PostalAddress24TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24TCH" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -577,8 +622,9 @@ func (v PostalAddress24TCH) Validate() error { func (v UnderlyingTransaction23) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInfAndCxl.Validate()) - rtp.AddError(&errs, v.TxInf.Validate()) + baseName := "UnderlyingTransaction23" + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndCxl", v.OrgnlGrpInfAndCxl.Validate()) + rtp.AddError(&errs, baseName+".TxInf", v.TxInf.Validate()) if errs.Empty() { return nil } @@ -587,8 +633,9 @@ func (v UnderlyingTransaction23) Validate() error { func (v UnderlyingTransaction23TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlGrpInfAndCxl.Validate()) - rtp.AddError(&errs, v.TxInf.Validate()) + baseName := "UnderlyingTransaction23TCH" + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndCxl", v.OrgnlGrpInfAndCxl.Validate()) + rtp.AddError(&errs, baseName+".TxInf", v.TxInf.Validate()) if errs.Empty() { return nil } @@ -598,152 +645,154 @@ func (v UnderlyingTransaction23TCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v CountryCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{2,2}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{2,2}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"); err != nil { + return err + } + return nil } func (v ExternalCancellationReason1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AC03", "AM09", "CUST", "DS24", "DUPL", "FRAD", "FRTR", "TECH", "UPAY")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AC03", "AM09", "CUST", "DS24", "DUPL", "FRAD", "FRTR", "TECH", "UPAY"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v LEIIdentifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`); err != nil { + return err } - return errs + return nil } func (v Max105Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 105)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 105); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max16Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 16)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 16); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v Max35TextTCH3) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "WIAM", "WICT", "WIDP", "WIFD", "WIFT", "WITH")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "WIAM", "WICT", "WIDP", "WIFD", "WIFT", "WITH"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max70Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 70)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 70); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pacs.009.001.08", "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pacs.009.001.08", "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v PhoneNumber) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`); err != nil { + return err } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/head_001_001_01/validate.go b/gen/head_001_001_01/validate.go index cff24bf..8f2ce55 100644 --- a/gen/head_001_001_01/validate.go +++ b/gen/head_001_001_01/validate.go @@ -11,9 +11,10 @@ import ( func (v BranchAndFinancialInstitutionIdentification5BAH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification5BAH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if v.BrnchId != nil { - rtp.AddError(&errs, v.BrnchId.Validate()) + rtp.AddError(&errs, baseName+".BrnchId", v.BrnchId.Validate()) } if errs.Empty() { return nil @@ -23,9 +24,10 @@ func (v BranchAndFinancialInstitutionIdentification5BAH) Validate() error { func (v BranchAndFinancialInstitutionIdentification5BAHTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification5BAHTCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if v.BrnchId != nil { - rtp.AddError(&errs, v.BrnchId.Validate()) + rtp.AddError(&errs, baseName+".BrnchId", v.BrnchId.Validate()) } if errs.Empty() { return nil @@ -35,7 +37,8 @@ func (v BranchAndFinancialInstitutionIdentification5BAHTCH) Validate() error { func (v BranchData2BAH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "BranchData2BAH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -44,7 +47,8 @@ func (v BranchData2BAH) Validate() error { func (v BranchData2BAHTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "BranchData2BAHTCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -53,16 +57,17 @@ func (v BranchData2BAHTCH) Validate() error { func (v BusinessApplicationHeaderV01) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Fr.Validate()) - rtp.AddError(&errs, v.To.Validate()) - rtp.AddError(&errs, v.BizMsgIdr.Validate()) - rtp.AddError(&errs, v.MsgDefIdr.Validate()) + baseName := "BusinessApplicationHeaderV01" + rtp.AddError(&errs, baseName+".Fr", v.Fr.Validate()) + rtp.AddError(&errs, baseName+".To", v.To.Validate()) + rtp.AddError(&errs, baseName+".BizMsgIdr", v.BizMsgIdr.Validate()) + rtp.AddError(&errs, baseName+".MsgDefIdr", v.MsgDefIdr.Validate()) if v.BizSvc != nil { - rtp.AddError(&errs, v.BizSvc.Validate()) + rtp.AddError(&errs, baseName+".BizSvc", v.BizSvc.Validate()) } - rtp.AddError(&errs, v.CreDt.Validate()) + rtp.AddError(&errs, baseName+".CreDt", v.CreDt.Validate()) if v.CpyDplct != nil { - rtp.AddError(&errs, v.CpyDplct.Validate()) + rtp.AddError(&errs, baseName+".CpyDplct", v.CpyDplct.Validate()) } if v.Sgntr != nil { } @@ -74,16 +79,17 @@ func (v BusinessApplicationHeaderV01) Validate() error { func (v BusinessApplicationHeaderV01TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Fr.Validate()) - rtp.AddError(&errs, v.To.Validate()) - rtp.AddError(&errs, v.BizMsgIdr.Validate()) - rtp.AddError(&errs, v.MsgDefIdr.Validate()) + baseName := "BusinessApplicationHeaderV01TCH" + rtp.AddError(&errs, baseName+".Fr", v.Fr.Validate()) + rtp.AddError(&errs, baseName+".To", v.To.Validate()) + rtp.AddError(&errs, baseName+".BizMsgIdr", v.BizMsgIdr.Validate()) + rtp.AddError(&errs, baseName+".MsgDefIdr", v.MsgDefIdr.Validate()) if v.BizSvc != nil { - rtp.AddError(&errs, v.BizSvc.Validate()) + rtp.AddError(&errs, baseName+".BizSvc", v.BizSvc.Validate()) } - rtp.AddError(&errs, v.CreDt.Validate()) + rtp.AddError(&errs, baseName+".CreDt", v.CreDt.Validate()) if v.CpyDplct != nil { - rtp.AddError(&errs, v.CpyDplct.Validate()) + rtp.AddError(&errs, baseName+".CpyDplct", v.CpyDplct.Validate()) } if v.Sgntr != nil { } @@ -95,7 +101,8 @@ func (v BusinessApplicationHeaderV01TCH) Validate() error { func (v ClearingSystemMemberIdentification2ADMN) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2ADMN" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -104,7 +111,8 @@ func (v ClearingSystemMemberIdentification2ADMN) Validate() error { func (v FinancialInstitutionIdentification8BAH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification8BAH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -113,8 +121,9 @@ func (v FinancialInstitutionIdentification8BAH) Validate() error { func (v Party9ChoiceBAH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party9ChoiceBAH" if v.FIId != nil { - rtp.AddError(&errs, v.FIId.Validate()) + rtp.AddError(&errs, baseName+".FIId", v.FIId.Validate()) } if errs.Empty() { return nil @@ -124,8 +133,9 @@ func (v Party9ChoiceBAH) Validate() error { func (v Party9ChoiceBAHTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party9ChoiceBAHTCH" if v.FIId != nil { - rtp.AddError(&errs, v.FIId.Validate()) + rtp.AddError(&errs, baseName+".FIId", v.FIId.Validate()) } if errs.Empty() { return nil @@ -136,52 +146,54 @@ func (v Party9ChoiceBAHTCH) Validate() error { // XSD SimpleType validations func (v CopyDuplicate1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "COPY", "DUPL")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "COPY", "DUPL"); err != nil { + return err } - return errs + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `B[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `B[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Min11Max11Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 11)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 11); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 11); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "acmt.022.001.02", "admi.002.001.01", "admi.004.001.02", "admn.001.001.01", "admn.002.001.01", "admn.003.001.01", "admn.004.001.01", "admn.005.001.01", "admn.006.001.01", "admn.007.001.01", "admn.008.001.01", "camt.026.001.07", "camt.028.001.09", "camt.029.001.09", "camt.035.001.05", "camt.056.001.08", "pacs.002.001.10", "pacs.008.001.08", "pacs.009.001.08", "pacs.028.001.03", "pain.013.001.07", "pain.014.001.07", "remt.001.001.04")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "acmt.022.001.02", "admi.002.001.01", "admi.004.001.02", "admn.001.001.01", "admn.002.001.01", "admn.003.001.01", "admn.004.001.01", "admn.005.001.01", "admn.006.001.01", "admn.007.001.01", "admn.008.001.01", "camt.026.001.07", "camt.028.001.09", "camt.029.001.09", "camt.035.001.05", "camt.056.001.08", "pacs.002.001.10", "pacs.008.001.08", "pacs.009.001.08", "pacs.028.001.03", "pain.013.001.07", "pain.014.001.07", "remt.001.001.04"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } diff --git a/gen/messages/validate.go b/gen/messages/validate.go index 10592b3..dd0b9df 100644 --- a/gen/messages/validate.go +++ b/gen/messages/validate.go @@ -11,75 +11,76 @@ import ( func (v Message) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AppHdr.Validate()) + baseName := "Message" + rtp.AddError(&errs, baseName+".AppHdr", v.AppHdr.Validate()) if v.CreditTransfer != nil { - rtp.AddError(&errs, v.CreditTransfer.Validate()) + rtp.AddError(&errs, baseName+".CreditTransfer", v.CreditTransfer.Validate()) } if v.MessageStatusReport != nil { - rtp.AddError(&errs, v.MessageStatusReport.Validate()) + rtp.AddError(&errs, baseName+".MessageStatusReport", v.MessageStatusReport.Validate()) } if v.FICreditTransfer != nil { - rtp.AddError(&errs, v.FICreditTransfer.Validate()) + rtp.AddError(&errs, baseName+".FICreditTransfer", v.FICreditTransfer.Validate()) } if v.Acknowledgement != nil { - rtp.AddError(&errs, v.Acknowledgement.Validate()) + rtp.AddError(&errs, baseName+".Acknowledgement", v.Acknowledgement.Validate()) } if v.ResponseRequestForInformation != nil { - rtp.AddError(&errs, v.ResponseRequestForInformation.Validate()) + rtp.AddError(&errs, baseName+".ResponseRequestForInformation", v.ResponseRequestForInformation.Validate()) } if v.RequestForInformation != nil { - rtp.AddError(&errs, v.RequestForInformation.Validate()) + rtp.AddError(&errs, baseName+".RequestForInformation", v.RequestForInformation.Validate()) } if v.ReturnOfFunds != nil { - rtp.AddError(&errs, v.ReturnOfFunds.Validate()) + rtp.AddError(&errs, baseName+".ReturnOfFunds", v.ReturnOfFunds.Validate()) } if v.PaymentRequest != nil { - rtp.AddError(&errs, v.PaymentRequest.Validate()) + rtp.AddError(&errs, baseName+".PaymentRequest", v.PaymentRequest.Validate()) } if v.ResponsePaymentRequest != nil { - rtp.AddError(&errs, v.ResponsePaymentRequest.Validate()) + rtp.AddError(&errs, baseName+".ResponsePaymentRequest", v.ResponsePaymentRequest.Validate()) } if v.ResponseReturnOfFunds != nil { - rtp.AddError(&errs, v.ResponseReturnOfFunds.Validate()) + rtp.AddError(&errs, baseName+".ResponseReturnOfFunds", v.ResponseReturnOfFunds.Validate()) } if v.EchoRequest != nil { - rtp.AddError(&errs, v.EchoRequest.Validate()) + rtp.AddError(&errs, baseName+".EchoRequest", v.EchoRequest.Validate()) } if v.EchoResponse != nil { - rtp.AddError(&errs, v.EchoResponse.Validate()) + rtp.AddError(&errs, baseName+".EchoResponse", v.EchoResponse.Validate()) } if v.SignOffRequest != nil { - rtp.AddError(&errs, v.SignOffRequest.Validate()) + rtp.AddError(&errs, baseName+".SignOffRequest", v.SignOffRequest.Validate()) } if v.SignOffResponse != nil { - rtp.AddError(&errs, v.SignOffResponse.Validate()) + rtp.AddError(&errs, baseName+".SignOffResponse", v.SignOffResponse.Validate()) } if v.SignOnRequest != nil { - rtp.AddError(&errs, v.SignOnRequest.Validate()) + rtp.AddError(&errs, baseName+".SignOnRequest", v.SignOnRequest.Validate()) } if v.SignOnResponse != nil { - rtp.AddError(&errs, v.SignOnResponse.Validate()) + rtp.AddError(&errs, baseName+".SignOnResponse", v.SignOnResponse.Validate()) } if v.StandaloneRemittance != nil { - rtp.AddError(&errs, v.StandaloneRemittance.Validate()) + rtp.AddError(&errs, baseName+".StandaloneRemittance", v.StandaloneRemittance.Validate()) } if v.SystemNotificationEvent != nil { - rtp.AddError(&errs, v.SystemNotificationEvent.Validate()) + rtp.AddError(&errs, baseName+".SystemNotificationEvent", v.SystemNotificationEvent.Validate()) } if v.MessageReject != nil { - rtp.AddError(&errs, v.MessageReject.Validate()) + rtp.AddError(&errs, baseName+".MessageReject", v.MessageReject.Validate()) } if v.TokenIdentification != nil { - rtp.AddError(&errs, v.TokenIdentification.Validate()) + rtp.AddError(&errs, baseName+".TokenIdentification", v.TokenIdentification.Validate()) } if v.ParticipantReport != nil { - rtp.AddError(&errs, v.ParticipantReport.Validate()) + rtp.AddError(&errs, baseName+".ParticipantReport", v.ParticipantReport.Validate()) } if v.ParticipantReportResponse != nil { - rtp.AddError(&errs, v.ParticipantReportResponse.Validate()) + rtp.AddError(&errs, baseName+".ParticipantReportResponse", v.ParticipantReportResponse.Validate()) } if v.PaymentStatusRequest != nil { - rtp.AddError(&errs, v.PaymentStatusRequest.Validate()) + rtp.AddError(&errs, baseName+".PaymentStatusRequest", v.PaymentStatusRequest.Validate()) } if errs.Empty() { return nil diff --git a/gen/pacs_002_001_10/validate.go b/gen/pacs_002_001_10/validate.go index 68ef0b9..d8f8f14 100644 --- a/gen/pacs_002_001_10/validate.go +++ b/gen/pacs_002_001_10/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,7 +23,8 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -31,7 +33,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -40,7 +43,8 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -49,7 +53,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -58,7 +63,8 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FIToFIPmtStsRpt.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".FIToFIPmtStsRpt", v.FIToFIPmtStsRpt.Validate()) if errs.Empty() { return nil } @@ -67,7 +73,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -76,7 +83,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -85,9 +93,10 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v FIToFIPaymentStatusReportV10) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.OrgnlGrpInfAndSts.Validate()) - rtp.AddError(&errs, v.TxInfAndSts.Validate()) + baseName := "FIToFIPaymentStatusReportV10" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndSts", v.OrgnlGrpInfAndSts.Validate()) + rtp.AddError(&errs, baseName+".TxInfAndSts", v.TxInfAndSts.Validate()) if errs.Empty() { return nil } @@ -96,9 +105,10 @@ func (v FIToFIPaymentStatusReportV10) Validate() error { func (v FIToFIPaymentStatusReportV10TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.OrgnlGrpInfAndSts.Validate()) - rtp.AddError(&errs, v.TxInfAndSts.Validate()) + baseName := "FIToFIPaymentStatusReportV10TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndSts", v.OrgnlGrpInfAndSts.Validate()) + rtp.AddError(&errs, baseName+".TxInfAndSts", v.TxInfAndSts.Validate()) if errs.Empty() { return nil } @@ -107,8 +117,9 @@ func (v FIToFIPaymentStatusReportV10TCH) Validate() error { func (v GroupHeader91) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GroupHeader91" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -117,8 +128,9 @@ func (v GroupHeader91) Validate() error { func (v GroupHeader91TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GroupHeader91TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -127,10 +139,11 @@ func (v GroupHeader91TCH) Validate() error { func (v OriginalGroupHeader17) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlNbOfTxs.Validate()) + baseName := "OriginalGroupHeader17" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlNbOfTxs", v.OrgnlNbOfTxs.Validate()) if errs.Empty() { return nil } @@ -139,10 +152,11 @@ func (v OriginalGroupHeader17) Validate() error { func (v OriginalGroupHeader17TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlNbOfTxs.Validate()) + baseName := "OriginalGroupHeader17TCH" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlNbOfTxs", v.OrgnlNbOfTxs.Validate()) if errs.Empty() { return nil } @@ -151,11 +165,12 @@ func (v OriginalGroupHeader17TCH) Validate() error { func (v OriginalTransactionReference28) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OriginalTransactionReference28" if v.IntrBkSttlmAmt != nil { - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) } if v.IntrBkSttlmDt != nil { - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) } if errs.Empty() { return nil @@ -165,25 +180,26 @@ func (v OriginalTransactionReference28) Validate() error { func (v PaymentTransaction110) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "PaymentTransaction110" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlTxId != nil { - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.TxSts.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } - rtp.AddError(&errs, v.AccptncDtTm.Validate()) + rtp.AddError(&errs, baseName+".AccptncDtTm", v.AccptncDtTm.Validate()) if v.ClrSysRef != nil { - rtp.AddError(&errs, v.ClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".ClrSysRef", v.ClrSysRef.Validate()) } - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if v.OrgnlTxRef != nil { - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) } if errs.Empty() { return nil @@ -193,25 +209,26 @@ func (v PaymentTransaction110) Validate() error { func (v PaymentTransaction110TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) + baseName := "PaymentTransaction110TCH" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) if v.OrgnlTxId != nil { - rtp.AddError(&errs, v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.TxSts.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } - rtp.AddError(&errs, v.AccptncDtTm.Validate()) + rtp.AddError(&errs, baseName+".AccptncDtTm", v.AccptncDtTm.Validate()) if v.ClrSysRef != nil { - rtp.AddError(&errs, v.ClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".ClrSysRef", v.ClrSysRef.Validate()) } - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if v.OrgnlTxRef != nil { - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) } if errs.Empty() { return nil @@ -221,11 +238,12 @@ func (v PaymentTransaction110TCH) Validate() error { func (v StatusReason6Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReason6Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -235,11 +253,12 @@ func (v StatusReason6Choice) Validate() error { func (v StatusReason6ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReason6ChoiceTCH" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -249,11 +268,12 @@ func (v StatusReason6ChoiceTCH) Validate() error { func (v StatusReasonInformation12) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReasonInformation12" if v.Rsn != nil { - rtp.AddError(&errs, v.Rsn.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) } if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -263,11 +283,12 @@ func (v StatusReasonInformation12) Validate() error { func (v StatusReasonInformation12TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReasonInformation12TCH" if v.Rsn != nil { - rtp.AddError(&errs, v.Rsn.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) } if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -278,112 +299,114 @@ func (v StatusReasonInformation12TCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v ExternalPaymentTransactionStatus1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACTC", "ACWP", "RCVD", "RJCT")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACTC", "ACWP", "RCVD", "RJCT"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalStatusReason1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AC02", "AC03", "AC04", "AC06", "AC11", "AC13", "AC14", "AG01", "AG03", "AGNT", "AM02", "AM04", "AM09", "AM12", "AM13", "AM14", "BE04", "BE06", "BE07", "BE10", "BE11", "BE16", "BE17", "DS0H", "DS24", "DT04", "DUPL", "FF02", "FF08", "MD07", "NARR", "RC01", "RC02", "RC03", "RC04", "SL03", "TK01", "TK02", "TK03", "TK04", "TK05", "TK06", "TK07", "TK08", "TK09", "TM01")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AC02", "AC03", "AC04", "AC06", "AC11", "AC13", "AC14", "AG01", "AG03", "AGNT", "AM02", "AM04", "AM09", "AM12", "AM13", "AM14", "BE04", "BE06", "BE07", "BE10", "BE11", "BE16", "BE17", "DS0H", "DS24", "DT04", "DUPL", "FF02", "FF08", "MD07", "NARR", "RC01", "RC02", "RC03", "RC04", "SL03", "TK01", "TK02", "TK03", "TK04", "TK05", "TK06", "TK07", "TK08", "TK09", "TM01"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max105Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 105)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 105); err != nil { + return err + } + return nil } func (v Max1NumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[1]{1,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[1]{1,1}`); err != nil { + return err } - return errs + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "acmt.022.001.02", "camt.026.001.07", "camt.028.001.09", "camt.029.001.09", "camt.035.001.05", "camt.056.001.08", "pacs.002.001.10", "pacs.008.001.08", "pacs.009.001.08", "pacs.028.001.03", "pain.013.001.07", "pain.014.001.07", "remt.001.001.04")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "acmt.022.001.02", "camt.026.001.07", "camt.028.001.09", "camt.029.001.09", "camt.035.001.05", "camt.056.001.08", "pacs.002.001.10", "pacs.008.001.08", "pacs.009.001.08", "pacs.028.001.03", "pain.013.001.07", "pain.014.001.07", "remt.001.001.04"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v ProprietaryReasonCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "1100", "9909", "9910", "9912", "9914", "9934", "9946", "9947", "9948", "9952", "9953", "9954", "9956", "9957", "9964", "NOAT")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "1100", "9909", "9910", "9912", "9914", "9934", "9946", "9947", "9948", "9952", "9953", "9954", "9956", "9957", "9964", "NOAT"); err != nil { + return err } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/pacs_008_001_08/validate.go b/gen/pacs_008_001_08/validate.go index a835a60..21f9669 100644 --- a/gen/pacs_008_001_08/validate.go +++ b/gen/pacs_008_001_08/validate.go @@ -11,8 +11,9 @@ import ( func (v AccountIdentification4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AccountIdentification4Choice" if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -22,8 +23,9 @@ func (v AccountIdentification4Choice) Validate() error { func (v ActiveCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -33,8 +35,9 @@ func (v ActiveCurrencyAndAmount) Validate() error { func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -44,7 +47,8 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -53,7 +57,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -62,12 +67,13 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v CashAccount38) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.Prxy != nil { - rtp.AddError(&errs, v.Prxy.Validate()) + rtp.AddError(&errs, baseName+".Prxy", v.Prxy.Validate()) } if errs.Empty() { return nil @@ -77,9 +83,10 @@ func (v CashAccount38) Validate() error { func (v CashAccount38TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if errs.Empty() { return nil @@ -89,12 +96,13 @@ func (v CashAccount38TCH) Validate() error { func (v CashAccount38TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38TCH2" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.Prxy != nil { - rtp.AddError(&errs, v.Prxy.Validate()) + rtp.AddError(&errs, baseName+".Prxy", v.Prxy.Validate()) } if errs.Empty() { return nil @@ -104,8 +112,9 @@ func (v CashAccount38TCH2) Validate() error { func (v CategoryPurpose1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CategoryPurpose1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -115,8 +124,9 @@ func (v CategoryPurpose1Choice) Validate() error { func (v ClearingSystemIdentification3Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ClearingSystemIdentification3Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -126,7 +136,8 @@ func (v ClearingSystemIdentification3Choice) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -135,7 +146,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -144,37 +156,38 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v CreditTransferTransaction39) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtId.Validate()) - rtp.AddError(&errs, v.PmtTpInf.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.ChrgBr.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "CreditTransferTransaction39" + rtp.AddError(&errs, baseName+".PmtId", v.PmtId.Validate()) + rtp.AddError(&errs, baseName+".PmtTpInf", v.PmtTpInf.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".ChrgBr", v.ChrgBr.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } if v.InitgPty != nil { - rtp.AddError(&errs, v.InitgPty.Validate()) - } - rtp.AddError(&errs, v.Dbtr.Validate()) - rtp.AddError(&errs, v.DbtrAcct.Validate()) - rtp.AddError(&errs, v.DbtrAgt.Validate()) - rtp.AddError(&errs, v.CdtrAgt.Validate()) - rtp.AddError(&errs, v.Cdtr.Validate()) - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) + } + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAgt", v.DbtrAgt.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) if v.UltmtCdtr != nil { - rtp.AddError(&errs, v.UltmtCdtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtCdtr", v.UltmtCdtr.Validate()) } if v.InstrForCdtrAgt != nil { for indx := range v.InstrForCdtrAgt { - rtp.AddError(&errs, v.InstrForCdtrAgt[indx].Validate()) + rtp.AddError(&errs, baseName+".InstrForCdtrAgt", v.InstrForCdtrAgt[indx].Validate()) } } if v.RltdRmtInf != nil { - rtp.AddError(&errs, v.RltdRmtInf.Validate()) + rtp.AddError(&errs, baseName+".RltdRmtInf", v.RltdRmtInf.Validate()) } if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -184,37 +197,38 @@ func (v CreditTransferTransaction39) Validate() error { func (v CreditTransferTransaction39TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtId.Validate()) - rtp.AddError(&errs, v.PmtTpInf.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.ChrgBr.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) + baseName := "CreditTransferTransaction39TCH" + rtp.AddError(&errs, baseName+".PmtId", v.PmtId.Validate()) + rtp.AddError(&errs, baseName+".PmtTpInf", v.PmtTpInf.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".ChrgBr", v.ChrgBr.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } if v.InitgPty != nil { - rtp.AddError(&errs, v.InitgPty.Validate()) - } - rtp.AddError(&errs, v.Dbtr.Validate()) - rtp.AddError(&errs, v.DbtrAcct.Validate()) - rtp.AddError(&errs, v.DbtrAgt.Validate()) - rtp.AddError(&errs, v.CdtrAgt.Validate()) - rtp.AddError(&errs, v.Cdtr.Validate()) - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) + } + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAgt", v.DbtrAgt.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) if v.UltmtCdtr != nil { - rtp.AddError(&errs, v.UltmtCdtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtCdtr", v.UltmtCdtr.Validate()) } if v.InstrForCdtrAgt != nil { for indx := range v.InstrForCdtrAgt { - rtp.AddError(&errs, v.InstrForCdtrAgt[indx].Validate()) + rtp.AddError(&errs, baseName+".InstrForCdtrAgt", v.InstrForCdtrAgt[indx].Validate()) } } if v.RltdRmtInf != nil { - rtp.AddError(&errs, v.RltdRmtInf.Validate()) + rtp.AddError(&errs, baseName+".RltdRmtInf", v.RltdRmtInf.Validate()) } if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -224,9 +238,10 @@ func (v CreditTransferTransaction39TCH) Validate() error { func (v DateAndPlaceOfBirth1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.BirthDt.Validate()) - rtp.AddError(&errs, v.CityOfBirth.Validate()) - rtp.AddError(&errs, v.CtryOfBirth.Validate()) + baseName := "DateAndPlaceOfBirth1" + rtp.AddError(&errs, baseName+".BirthDt", v.BirthDt.Validate()) + rtp.AddError(&errs, baseName+".CityOfBirth", v.CityOfBirth.Validate()) + rtp.AddError(&errs, baseName+".CtryOfBirth", v.CtryOfBirth.Validate()) if errs.Empty() { return nil } @@ -235,8 +250,9 @@ func (v DateAndPlaceOfBirth1) Validate() error { func (v DiscountAmountAndType1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DiscountAmountAndType1" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -245,8 +261,9 @@ func (v DiscountAmountAndType1) Validate() error { func (v DiscountAmountAndType1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DiscountAmountAndType1TCH" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -255,8 +272,9 @@ func (v DiscountAmountAndType1TCH) Validate() error { func (v DiscountAmountType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -266,8 +284,9 @@ func (v DiscountAmountType1Choice) Validate() error { func (v DiscountAmountType1ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1ChoiceTCH" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -277,7 +296,8 @@ func (v DiscountAmountType1ChoiceTCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FIToFICstmrCdtTrf.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".FIToFICstmrCdtTrf", v.FIToFICstmrCdtTrf.Validate()) if errs.Empty() { return nil } @@ -286,7 +306,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -295,7 +316,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -304,8 +326,9 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v FIToFICustomerCreditTransferV08) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.CdtTrfTxInf.Validate()) + baseName := "FIToFICustomerCreditTransferV08" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".CdtTrfTxInf", v.CdtTrfTxInf.Validate()) if errs.Empty() { return nil } @@ -314,8 +337,9 @@ func (v FIToFICustomerCreditTransferV08) Validate() error { func (v FIToFICustomerCreditTransferV08TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.CdtTrfTxInf.Validate()) + baseName := "FIToFICustomerCreditTransferV08TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".CdtTrfTxInf", v.CdtTrfTxInf.Validate()) if errs.Empty() { return nil } @@ -324,7 +348,8 @@ func (v FIToFICustomerCreditTransferV08TCH) Validate() error { func (v GenericAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -333,9 +358,10 @@ func (v GenericAccountIdentification1) Validate() error { func (v GenericPersonIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericPersonIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -345,12 +371,13 @@ func (v GenericPersonIdentification1) Validate() error { func (v GroupHeader93) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.NbOfTxs.Validate()) - rtp.AddError(&errs, v.TtlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) - rtp.AddError(&errs, v.SttlmInf.Validate()) + baseName := "GroupHeader93" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".NbOfTxs", v.NbOfTxs.Validate()) + rtp.AddError(&errs, baseName+".TtlIntrBkSttlmAmt", v.TtlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".SttlmInf", v.SttlmInf.Validate()) if errs.Empty() { return nil } @@ -359,12 +386,13 @@ func (v GroupHeader93) Validate() error { func (v GroupHeader93TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.NbOfTxs.Validate()) - rtp.AddError(&errs, v.TtlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) - rtp.AddError(&errs, v.SttlmInf.Validate()) + baseName := "GroupHeader93TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".NbOfTxs", v.NbOfTxs.Validate()) + rtp.AddError(&errs, baseName+".TtlIntrBkSttlmAmt", v.TtlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".SttlmInf", v.SttlmInf.Validate()) if errs.Empty() { return nil } @@ -373,8 +401,9 @@ func (v GroupHeader93TCH) Validate() error { func (v InstructionForCreditorAgent1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Cd.Validate()) - rtp.AddError(&errs, v.InstrInf.Validate()) + baseName := "InstructionForCreditorAgent1" + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) + rtp.AddError(&errs, baseName+".InstrInf", v.InstrInf.Validate()) if errs.Empty() { return nil } @@ -383,8 +412,9 @@ func (v InstructionForCreditorAgent1) Validate() error { func (v InstructionForCreditorAgent1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Cd.Validate()) - rtp.AddError(&errs, v.InstrInf.Validate()) + baseName := "InstructionForCreditorAgent1TCH" + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) + rtp.AddError(&errs, baseName+".InstrInf", v.InstrInf.Validate()) if errs.Empty() { return nil } @@ -393,8 +423,9 @@ func (v InstructionForCreditorAgent1TCH) Validate() error { func (v LocalInstrument2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "LocalInstrument2Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -404,7 +435,8 @@ func (v LocalInstrument2Choice) Validate() error { func (v OrganisationIdentification29) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.LEI.Validate()) + baseName := "OrganisationIdentification29" + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) if errs.Empty() { return nil } @@ -413,12 +445,13 @@ func (v OrganisationIdentification29) Validate() error { func (v OrganisationIdentification29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29TCH" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -429,11 +462,12 @@ func (v OrganisationIdentification29TCH) Validate() error { func (v Party38Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38Choice" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -443,11 +477,12 @@ func (v Party38Choice) Validate() error { func (v Party38ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -457,8 +492,9 @@ func (v Party38ChoiceTCH) Validate() error { func (v Party38ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH2" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -468,14 +504,15 @@ func (v Party38ChoiceTCH2) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -485,12 +522,13 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -500,9 +538,10 @@ func (v PartyIdentification135TCH) Validate() error { func (v PartyIdentification135TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH2" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -512,12 +551,13 @@ func (v PartyIdentification135TCH2) Validate() error { func (v PartyIdentification135TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH3" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -527,14 +567,15 @@ func (v PartyIdentification135TCH3) Validate() error { func (v PaymentIdentification7) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "PaymentIdentification7" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if v.UETR != nil { - rtp.AddError(&errs, v.UETR.Validate()) + rtp.AddError(&errs, baseName+".UETR", v.UETR.Validate()) } if v.ClrSysRef != nil { - rtp.AddError(&errs, v.ClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".ClrSysRef", v.ClrSysRef.Validate()) } if errs.Empty() { return nil @@ -544,14 +585,15 @@ func (v PaymentIdentification7) Validate() error { func (v PaymentIdentification7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "PaymentIdentification7TCH" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if v.UETR != nil { - rtp.AddError(&errs, v.UETR.Validate()) + rtp.AddError(&errs, baseName+".UETR", v.UETR.Validate()) } if v.ClrSysRef != nil { - rtp.AddError(&errs, v.ClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".ClrSysRef", v.ClrSysRef.Validate()) } if errs.Empty() { return nil @@ -561,9 +603,10 @@ func (v PaymentIdentification7TCH) Validate() error { func (v PaymentTypeInformation28) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SvcLvl.Validate()) - rtp.AddError(&errs, v.LclInstrm.Validate()) - rtp.AddError(&errs, v.CtgyPurp.Validate()) + baseName := "PaymentTypeInformation28" + rtp.AddError(&errs, baseName+".SvcLvl", v.SvcLvl.Validate()) + rtp.AddError(&errs, baseName+".LclInstrm", v.LclInstrm.Validate()) + rtp.AddError(&errs, baseName+".CtgyPurp", v.CtgyPurp.Validate()) if errs.Empty() { return nil } @@ -572,9 +615,10 @@ func (v PaymentTypeInformation28) Validate() error { func (v PaymentTypeInformation28TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SvcLvl.Validate()) - rtp.AddError(&errs, v.LclInstrm.Validate()) - rtp.AddError(&errs, v.CtgyPurp.Validate()) + baseName := "PaymentTypeInformation28TCH" + rtp.AddError(&errs, baseName+".SvcLvl", v.SvcLvl.Validate()) + rtp.AddError(&errs, baseName+".LclInstrm", v.LclInstrm.Validate()) + rtp.AddError(&errs, baseName+".CtgyPurp", v.CtgyPurp.Validate()) if errs.Empty() { return nil } @@ -583,12 +627,13 @@ func (v PaymentTypeInformation28TCH) Validate() error { func (v PersonIdentification13) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -599,12 +644,13 @@ func (v PersonIdentification13) Validate() error { func (v PersonIdentification13TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13TCH" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -615,7 +661,8 @@ func (v PersonIdentification13TCH) Validate() error { func (v PersonIdentification13TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13TCH2" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -624,16 +671,17 @@ func (v PersonIdentification13TCH2) Validate() error { func (v PostalAddress24) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -643,16 +691,17 @@ func (v PostalAddress24) Validate() error { func (v PostalAddress24TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24TCH" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -662,7 +711,8 @@ func (v PostalAddress24TCH) Validate() error { func (v ProxyAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "ProxyAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -671,7 +721,8 @@ func (v ProxyAccountIdentification1) Validate() error { func (v ProxyAccountIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "ProxyAccountIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -680,12 +731,13 @@ func (v ProxyAccountIdentification1TCH) Validate() error { func (v ReferredDocumentInformation7) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentInformation7" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } - rtp.AddError(&errs, v.Nb.Validate()) + rtp.AddError(&errs, baseName+".Nb", v.Nb.Validate()) if v.RltdDt != nil { - rtp.AddError(&errs, v.RltdDt.Validate()) + rtp.AddError(&errs, baseName+".RltdDt", v.RltdDt.Validate()) } if errs.Empty() { return nil @@ -695,12 +747,13 @@ func (v ReferredDocumentInformation7) Validate() error { func (v ReferredDocumentInformation7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentInformation7TCH" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } - rtp.AddError(&errs, v.Nb.Validate()) + rtp.AddError(&errs, baseName+".Nb", v.Nb.Validate()) if v.RltdDt != nil { - rtp.AddError(&errs, v.RltdDt.Validate()) + rtp.AddError(&errs, baseName+".RltdDt", v.RltdDt.Validate()) } if errs.Empty() { return nil @@ -710,9 +763,10 @@ func (v ReferredDocumentInformation7TCH) Validate() error { func (v RemittanceAmount2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2" if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if errs.Empty() { @@ -723,9 +777,10 @@ func (v RemittanceAmount2) Validate() error { func (v RemittanceAmount2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2TCH" if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if errs.Empty() { @@ -736,11 +791,12 @@ func (v RemittanceAmount2TCH) Validate() error { func (v RemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation16" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } if v.Strd != nil { - rtp.AddError(&errs, v.Strd.Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd.Validate()) } if errs.Empty() { return nil @@ -750,11 +806,12 @@ func (v RemittanceInformation16) Validate() error { func (v RemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation16TCH" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } if v.Strd != nil { - rtp.AddError(&errs, v.Strd.Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd.Validate()) } if errs.Empty() { return nil @@ -764,11 +821,12 @@ func (v RemittanceInformation16TCH) Validate() error { func (v RemittanceLocation7) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceLocation7" if v.RmtId != nil { - rtp.AddError(&errs, v.RmtId.Validate()) + rtp.AddError(&errs, baseName+".RmtId", v.RmtId.Validate()) } if v.RmtLctnDtls != nil { - rtp.AddError(&errs, v.RmtLctnDtls.Validate()) + rtp.AddError(&errs, baseName+".RmtLctnDtls", v.RmtLctnDtls.Validate()) } if errs.Empty() { return nil @@ -778,11 +836,12 @@ func (v RemittanceLocation7) Validate() error { func (v RemittanceLocation7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceLocation7TCH" if v.RmtId != nil { - rtp.AddError(&errs, v.RmtId.Validate()) + rtp.AddError(&errs, baseName+".RmtId", v.RmtId.Validate()) } if v.RmtLctnDtls != nil { - rtp.AddError(&errs, v.RmtLctnDtls.Validate()) + rtp.AddError(&errs, baseName+".RmtLctnDtls", v.RmtLctnDtls.Validate()) } if errs.Empty() { return nil @@ -792,9 +851,10 @@ func (v RemittanceLocation7TCH) Validate() error { func (v RemittanceLocationData1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Mtd.Validate()) + baseName := "RemittanceLocationData1" + rtp.AddError(&errs, baseName+".Mtd", v.Mtd.Validate()) if v.ElctrncAdr != nil { - rtp.AddError(&errs, v.ElctrncAdr.Validate()) + rtp.AddError(&errs, baseName+".ElctrncAdr", v.ElctrncAdr.Validate()) } if errs.Empty() { return nil @@ -804,8 +864,9 @@ func (v RemittanceLocationData1) Validate() error { func (v ServiceLevel8Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ServiceLevel8Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -815,8 +876,9 @@ func (v ServiceLevel8Choice) Validate() error { func (v SettlementInstruction7) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SttlmMtd.Validate()) - rtp.AddError(&errs, v.ClrSys.Validate()) + baseName := "SettlementInstruction7" + rtp.AddError(&errs, baseName+".SttlmMtd", v.SttlmMtd.Validate()) + rtp.AddError(&errs, baseName+".ClrSys", v.ClrSys.Validate()) if errs.Empty() { return nil } @@ -825,8 +887,9 @@ func (v SettlementInstruction7) Validate() error { func (v SettlementInstruction7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SttlmMtd.Validate()) - rtp.AddError(&errs, v.ClrSys.Validate()) + baseName := "SettlementInstruction7TCH" + rtp.AddError(&errs, baseName+".SttlmMtd", v.SttlmMtd.Validate()) + rtp.AddError(&errs, baseName+".ClrSys", v.ClrSys.Validate()) if errs.Empty() { return nil } @@ -835,19 +898,20 @@ func (v SettlementInstruction7TCH) Validate() error { func (v StructuredRemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16" if v.RfrdDocInf != nil { for indx := range v.RfrdDocInf { - rtp.AddError(&errs, v.RfrdDocInf[indx].Validate()) + rtp.AddError(&errs, baseName+".RfrdDocInf", v.RfrdDocInf[indx].Validate()) } } if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if v.Invcr != nil { - rtp.AddError(&errs, v.Invcr.Validate()) + rtp.AddError(&errs, baseName+".Invcr", v.Invcr.Validate()) } if v.Invcee != nil { - rtp.AddError(&errs, v.Invcee.Validate()) + rtp.AddError(&errs, baseName+".Invcee", v.Invcee.Validate()) } if errs.Empty() { return nil @@ -857,19 +921,20 @@ func (v StructuredRemittanceInformation16) Validate() error { func (v StructuredRemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16TCH" if v.RfrdDocInf != nil { for indx := range v.RfrdDocInf { - rtp.AddError(&errs, v.RfrdDocInf[indx].Validate()) + rtp.AddError(&errs, baseName+".RfrdDocInf", v.RfrdDocInf[indx].Validate()) } } if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if v.Invcr != nil { - rtp.AddError(&errs, v.Invcr.Validate()) + rtp.AddError(&errs, baseName+".Invcr", v.Invcr.Validate()) } if v.Invcee != nil { - rtp.AddError(&errs, v.Invcee.Validate()) + rtp.AddError(&errs, baseName+".Invcee", v.Invcee.Validate()) } if errs.Empty() { return nil @@ -879,9 +944,10 @@ func (v StructuredRemittanceInformation16TCH) Validate() error { func (v GenericOrganisationIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -891,7 +957,8 @@ func (v GenericOrganisationIdentification1) Validate() error { func (v GenericOrganisationIdentification1TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH3" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -900,8 +967,9 @@ func (v GenericOrganisationIdentification1TCH3) Validate() error { func (v OrganisationIdentification29TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29TCH2" for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } if errs.Empty() { return nil @@ -911,12 +979,13 @@ func (v OrganisationIdentification29TCH2) Validate() error { func (v OrganisationIdentification29TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29TCH3" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -927,7 +996,8 @@ func (v OrganisationIdentification29TCH3) Validate() error { func (v OrganisationIdentification29TCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Othr.Validate()) + baseName := "OrganisationIdentification29TCH4" + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) if errs.Empty() { return nil } @@ -936,8 +1006,9 @@ func (v OrganisationIdentification29TCH4) Validate() error { func (v OrganisationIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentificationSchemeName1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -947,11 +1018,12 @@ func (v OrganisationIdentificationSchemeName1Choice) Validate() error { func (v Party38ChoiceTCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH3" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -961,8 +1033,9 @@ func (v Party38ChoiceTCH3) Validate() error { func (v Party38ChoiceTCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH4" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -972,8 +1045,9 @@ func (v Party38ChoiceTCH4) Validate() error { func (v PersonIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentificationSchemeName1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -983,7 +1057,8 @@ func (v PersonIdentificationSchemeName1Choice) Validate() error { func (v PartyIdentification135TCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "PartyIdentification135TCH4" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -992,7 +1067,8 @@ func (v PartyIdentification135TCH4) Validate() error { func (v ReferredDocumentType5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "ReferredDocumentType5" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if errs.Empty() { return nil } @@ -1001,7 +1077,8 @@ func (v ReferredDocumentType5) Validate() error { func (v ReferredDocumentType5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "ReferredDocumentType5TCH" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if errs.Empty() { return nil } @@ -1010,11 +1087,12 @@ func (v ReferredDocumentType5TCH) Validate() error { func (v ReferredDocumentType5Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentType5Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -1024,11 +1102,12 @@ func (v ReferredDocumentType5Choice) Validate() error { func (v ReferredDocumentType5ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentType5ChoiceTCH" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -1039,290 +1118,288 @@ func (v ReferredDocumentType5ChoiceTCH) Validate() error { // XSD SimpleType validations func (v ActiveCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v CatePurpProp) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "BUSINESS", "CONSUMER")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "BUSINESS", "CONSUMER"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v ChargeBearerType1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "SLEV")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "SLEV"); err != nil { + return err } - return errs + return nil } func (v CountryCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{2,2}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{2,2}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"); err != nil { + return err + } + return nil } func (v ExternalCashClearingSystem1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "TCH")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 3)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "TCH"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 3); err != nil { + return err + } + return nil } func (v ExternalServiceLevel1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "SDVA")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "SDVA"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Instruction3CodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "PRTK", "TKCM", "TKSG", "TKSP", "TKVE", "TKXP", "TOKN", "VLTK")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "PRTK", "TKCM", "TKSG", "TKSP", "TKVE", "TKXP", "TOKN", "VLTK"); err != nil { + return err } - return errs + return nil } func (v LEIIdentifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`); err != nil { + return err } - return errs + return nil } func (v LocalProp) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "FOREIGN AFFILIATE", "INTERMEDIARY", "IXB", "STANDARD", "ZELLE")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "FOREIGN AFFILIATE", "INTERMEDIARY", "IXB", "STANDARD", "ZELLE"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max140TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max16Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 16)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 16); err != nil { + return err + } + return nil } func (v Max1NumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[1]{1,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[1]{1,1}`); err != nil { + return err } - return errs + return nil } func (v Max2048Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 2048)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 2048); err != nil { + return err + } + return nil } func (v Max2048TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 256)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 256); err != nil { + return err + } + return nil } func (v Max34Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 34)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 34); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH3) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v Max35TextTCH4) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "DSCT", "FULL", "ORIG")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "DSCT", "FULL", "ORIG"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max70Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 70)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 70); err != nil { + return err + } + return nil } func (v RemittanceLocationMethod2Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "EMAL", "URID")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "EMAL", "URID"); err != nil { + return err } - return errs + return nil } func (v SettlementMethod1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CLRG")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CLRG"); err != nil { + return err } - return errs + return nil } func (v DocumentType6Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CINV")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CINV"); err != nil { + return err } - return errs + return nil } func (v DocumentType6CodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CINV")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CINV"); err != nil { + return err } - return errs + return nil } func (v Max35TextTCH5) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CSCM", "RTRN")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CSCM", "RTRN"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/pacs_009_001_08/validate.go b/gen/pacs_009_001_08/validate.go index b23e7b8..ffe9260 100644 --- a/gen/pacs_009_001_08/validate.go +++ b/gen/pacs_009_001_08/validate.go @@ -11,8 +11,9 @@ import ( func (v AccountIdentification4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AccountIdentification4Choice" if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -22,8 +23,9 @@ func (v AccountIdentification4Choice) Validate() error { func (v ActiveCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -33,7 +35,8 @@ func (v ActiveCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -42,7 +45,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -51,7 +55,8 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v CashAccount38) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -60,8 +65,9 @@ func (v CashAccount38) Validate() error { func (v ClearingSystemIdentification3Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ClearingSystemIdentification3Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -71,7 +77,8 @@ func (v ClearingSystemIdentification3Choice) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -80,7 +87,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -89,19 +97,20 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v CreditTransferTransaction36) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtId.Validate()) - rtp.AddError(&errs, v.PmtTpInf.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.Dbtr.Validate()) + baseName := "CreditTransferTransaction36" + rtp.AddError(&errs, baseName+".PmtId", v.PmtId.Validate()) + rtp.AddError(&errs, baseName+".PmtTpInf", v.PmtTpInf.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) if v.DbtrAcct != nil { - rtp.AddError(&errs, v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) } - rtp.AddError(&errs, v.Cdtr.Validate()) - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -111,19 +120,20 @@ func (v CreditTransferTransaction36) Validate() error { func (v CreditTransferTransaction36TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtId.Validate()) - rtp.AddError(&errs, v.PmtTpInf.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.Dbtr.Validate()) + baseName := "CreditTransferTransaction36TCH" + rtp.AddError(&errs, baseName+".PmtId", v.PmtId.Validate()) + rtp.AddError(&errs, baseName+".PmtTpInf", v.PmtTpInf.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) if v.DbtrAcct != nil { - rtp.AddError(&errs, v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) } - rtp.AddError(&errs, v.Cdtr.Validate()) - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -133,7 +143,8 @@ func (v CreditTransferTransaction36TCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FICdtTrf.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".FICdtTrf", v.FICdtTrf.Validate()) if errs.Empty() { return nil } @@ -142,8 +153,9 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionCreditTransferV08) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.CdtTrfTxInf.Validate()) + baseName := "FinancialInstitutionCreditTransferV08" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".CdtTrfTxInf", v.CdtTrfTxInf.Validate()) if errs.Empty() { return nil } @@ -152,8 +164,9 @@ func (v FinancialInstitutionCreditTransferV08) Validate() error { func (v FinancialInstitutionCreditTransferV08TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.CdtTrfTxInf.Validate()) + baseName := "FinancialInstitutionCreditTransferV08TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".CdtTrfTxInf", v.CdtTrfTxInf.Validate()) if errs.Empty() { return nil } @@ -162,7 +175,8 @@ func (v FinancialInstitutionCreditTransferV08TCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -171,7 +185,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -180,7 +195,8 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v GenericAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -189,12 +205,13 @@ func (v GenericAccountIdentification1) Validate() error { func (v GroupHeader93) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.NbOfTxs.Validate()) - rtp.AddError(&errs, v.TtlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) - rtp.AddError(&errs, v.SttlmInf.Validate()) + baseName := "GroupHeader93" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".NbOfTxs", v.NbOfTxs.Validate()) + rtp.AddError(&errs, baseName+".TtlIntrBkSttlmAmt", v.TtlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".SttlmInf", v.SttlmInf.Validate()) if errs.Empty() { return nil } @@ -203,12 +220,13 @@ func (v GroupHeader93) Validate() error { func (v GroupHeader93TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.NbOfTxs.Validate()) - rtp.AddError(&errs, v.TtlIntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) - rtp.AddError(&errs, v.SttlmInf.Validate()) + baseName := "GroupHeader93TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".NbOfTxs", v.NbOfTxs.Validate()) + rtp.AddError(&errs, baseName+".TtlIntrBkSttlmAmt", v.TtlIntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) + rtp.AddError(&errs, baseName+".SttlmInf", v.SttlmInf.Validate()) if errs.Empty() { return nil } @@ -217,11 +235,12 @@ func (v GroupHeader93TCH) Validate() error { func (v PaymentIdentification7) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "PaymentIdentification7" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if v.ClrSysRef != nil { - rtp.AddError(&errs, v.ClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".ClrSysRef", v.ClrSysRef.Validate()) } if errs.Empty() { return nil @@ -231,11 +250,12 @@ func (v PaymentIdentification7) Validate() error { func (v PaymentIdentification7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.InstrId.Validate()) - rtp.AddError(&errs, v.EndToEndId.Validate()) - rtp.AddError(&errs, v.TxId.Validate()) + baseName := "PaymentIdentification7TCH" + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) if v.ClrSysRef != nil { - rtp.AddError(&errs, v.ClrSysRef.Validate()) + rtp.AddError(&errs, baseName+".ClrSysRef", v.ClrSysRef.Validate()) } if errs.Empty() { return nil @@ -245,7 +265,8 @@ func (v PaymentIdentification7TCH) Validate() error { func (v PaymentTypeInformation28) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SvcLvl.Validate()) + baseName := "PaymentTypeInformation28" + rtp.AddError(&errs, baseName+".SvcLvl", v.SvcLvl.Validate()) if errs.Empty() { return nil } @@ -254,7 +275,8 @@ func (v PaymentTypeInformation28) Validate() error { func (v PaymentTypeInformation28TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SvcLvl.Validate()) + baseName := "PaymentTypeInformation28TCH" + rtp.AddError(&errs, baseName+".SvcLvl", v.SvcLvl.Validate()) if errs.Empty() { return nil } @@ -263,8 +285,9 @@ func (v PaymentTypeInformation28TCH) Validate() error { func (v RemittanceInformation2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation2" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } if errs.Empty() { return nil @@ -274,8 +297,9 @@ func (v RemittanceInformation2) Validate() error { func (v RemittanceInformation2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation2TCH" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } if errs.Empty() { return nil @@ -285,8 +309,9 @@ func (v RemittanceInformation2TCH) Validate() error { func (v ServiceLevel8Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ServiceLevel8Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -296,8 +321,9 @@ func (v ServiceLevel8Choice) Validate() error { func (v SettlementInstruction7) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SttlmMtd.Validate()) - rtp.AddError(&errs, v.ClrSys.Validate()) + baseName := "SettlementInstruction7" + rtp.AddError(&errs, baseName+".SttlmMtd", v.SttlmMtd.Validate()) + rtp.AddError(&errs, baseName+".ClrSys", v.ClrSys.Validate()) if errs.Empty() { return nil } @@ -306,8 +332,9 @@ func (v SettlementInstruction7) Validate() error { func (v SettlementInstruction7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SttlmMtd.Validate()) - rtp.AddError(&errs, v.ClrSys.Validate()) + baseName := "SettlementInstruction7TCH" + rtp.AddError(&errs, baseName+".SttlmMtd", v.SttlmMtd.Validate()) + rtp.AddError(&errs, baseName+".ClrSys", v.ClrSys.Validate()) if errs.Empty() { return nil } @@ -317,113 +344,117 @@ func (v SettlementInstruction7TCH) Validate() error { // XSD SimpleType validations func (v ActiveCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v ExternalCashClearingSystem1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "TCH")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 3)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "TCH"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 3); err != nil { + return err + } + return nil } func (v ExternalServiceLevel1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "SDVA")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "SDVA"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max1NumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[1]{1,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[1]{1,1}`); err != nil { + return err } - return errs + return nil } func (v Max34Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 34)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 34); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH3) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v SettlementMethod1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CLRG")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CLRG"); err != nil { + return err } - return errs + return nil } diff --git a/gen/pacs_028_001_03/validate.go b/gen/pacs_028_001_03/validate.go index 27688fb..3090fd4 100644 --- a/gen/pacs_028_001_03/validate.go +++ b/gen/pacs_028_001_03/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,7 +23,8 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -31,7 +33,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -40,7 +43,8 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -49,7 +53,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -58,7 +63,8 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FIToFIPmtStsReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".FIToFIPmtStsReq", v.FIToFIPmtStsReq.Validate()) if errs.Empty() { return nil } @@ -67,7 +73,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -76,7 +83,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -85,9 +93,10 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v FIToFIPaymentStatusRequestV03) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.TxInf.Validate()) + baseName := "FIToFIPaymentStatusRequestV03" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".TxInf", v.TxInf.Validate()) if errs.Empty() { return nil } @@ -96,9 +105,10 @@ func (v FIToFIPaymentStatusRequestV03) Validate() error { func (v FIToFIPaymentStatusRequestV03TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.OrgnlGrpInf.Validate()) - rtp.AddError(&errs, v.TxInf.Validate()) + baseName := "FIToFIPaymentStatusRequestV03TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".OrgnlGrpInf", v.OrgnlGrpInf.Validate()) + rtp.AddError(&errs, baseName+".TxInf", v.TxInf.Validate()) if errs.Empty() { return nil } @@ -107,8 +117,9 @@ func (v FIToFIPaymentStatusRequestV03TCH) Validate() error { func (v GroupHeader91) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GroupHeader91" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -117,8 +128,9 @@ func (v GroupHeader91) Validate() error { func (v GroupHeader91TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) + baseName := "GroupHeader91TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) if errs.Empty() { return nil } @@ -127,10 +139,11 @@ func (v GroupHeader91TCH) Validate() error { func (v OriginalGroupInformation27) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlNbOfTxs.Validate()) + baseName := "OriginalGroupInformation27" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlNbOfTxs", v.OrgnlNbOfTxs.Validate()) if errs.Empty() { return nil } @@ -139,10 +152,11 @@ func (v OriginalGroupInformation27) Validate() error { func (v OriginalGroupInformation27TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlNbOfTxs.Validate()) + baseName := "OriginalGroupInformation27TCH" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlNbOfTxs", v.OrgnlNbOfTxs.Validate()) if errs.Empty() { return nil } @@ -151,8 +165,9 @@ func (v OriginalGroupInformation27TCH) Validate() error { func (v OriginalTransactionReference28) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) + baseName := "OriginalTransactionReference28" + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) if errs.Empty() { return nil } @@ -161,8 +176,9 @@ func (v OriginalTransactionReference28) Validate() error { func (v OriginalTransactionReference28TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.IntrBkSttlmAmt.Validate()) - rtp.AddError(&errs, v.IntrBkSttlmDt.Validate()) + baseName := "OriginalTransactionReference28TCH" + rtp.AddError(&errs, baseName+".IntrBkSttlmAmt", v.IntrBkSttlmAmt.Validate()) + rtp.AddError(&errs, baseName+".IntrBkSttlmDt", v.IntrBkSttlmDt.Validate()) if errs.Empty() { return nil } @@ -171,12 +187,13 @@ func (v OriginalTransactionReference28TCH) Validate() error { func (v PaymentTransaction113) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.OrgnlTxId.Validate()) - rtp.AddError(&errs, v.AccptncDtTm.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + baseName := "PaymentTransaction113" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".AccptncDtTm", v.AccptncDtTm.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) if errs.Empty() { return nil } @@ -185,12 +202,13 @@ func (v PaymentTransaction113) Validate() error { func (v PaymentTransaction113TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlInstrId.Validate()) - rtp.AddError(&errs, v.OrgnlTxId.Validate()) - rtp.AddError(&errs, v.AccptncDtTm.Validate()) - rtp.AddError(&errs, v.InstgAgt.Validate()) - rtp.AddError(&errs, v.InstdAgt.Validate()) - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + baseName := "PaymentTransaction113TCH" + rtp.AddError(&errs, baseName+".OrgnlInstrId", v.OrgnlInstrId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxId", v.OrgnlTxId.Validate()) + rtp.AddError(&errs, baseName+".AccptncDtTm", v.AccptncDtTm.Validate()) + rtp.AddError(&errs, baseName+".InstgAgt", v.InstgAgt.Validate()) + rtp.AddError(&errs, baseName+".InstdAgt", v.InstdAgt.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) if errs.Empty() { return nil } @@ -200,62 +218,64 @@ func (v PaymentTransaction113TCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v Max1NumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[1]{1,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[1]{1,1}`); err != nil { + return err } - return errs + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pacs.009.001.08", "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pacs.008.001.06", "pacs.008.001.08", "pacs.009.001.08", "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } diff --git a/gen/pain_013_001_07/validate.go b/gen/pain_013_001_07/validate.go index fd9b7dd..6f7bc93 100644 --- a/gen/pain_013_001_07/validate.go +++ b/gen/pain_013_001_07/validate.go @@ -11,8 +11,9 @@ import ( func (v AccountIdentification4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AccountIdentification4Choice" if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -22,8 +23,9 @@ func (v AccountIdentification4Choice) Validate() error { func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -33,8 +35,9 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v AmountType4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AmountType4Choice" if v.InstdAmt != nil { - rtp.AddError(&errs, v.InstdAmt.Validate()) + rtp.AddError(&errs, baseName+".InstdAmt", v.InstdAmt.Validate()) } if errs.Empty() { return nil @@ -44,7 +47,8 @@ func (v AmountType4Choice) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -53,7 +57,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -62,12 +67,13 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v CashAccount38) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.Prxy != nil { - rtp.AddError(&errs, v.Prxy.Validate()) + rtp.AddError(&errs, baseName+".Prxy", v.Prxy.Validate()) } if errs.Empty() { return nil @@ -77,12 +83,13 @@ func (v CashAccount38) Validate() error { func (v CashAccount38TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.Prxy != nil { - rtp.AddError(&errs, v.Prxy.Validate()) + rtp.AddError(&errs, baseName+".Prxy", v.Prxy.Validate()) } if errs.Empty() { return nil @@ -92,9 +99,10 @@ func (v CashAccount38TCH) Validate() error { func (v CashAccount38TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38TCH2" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if errs.Empty() { return nil @@ -104,8 +112,9 @@ func (v CashAccount38TCH2) Validate() error { func (v CategoryPurpose1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CategoryPurpose1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -115,7 +124,8 @@ func (v CategoryPurpose1Choice) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -124,7 +134,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -133,8 +144,9 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v Contact4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Contact4" if v.PhneNb != nil { - rtp.AddError(&errs, v.PhneNb.Validate()) + rtp.AddError(&errs, baseName+".PhneNb", v.PhneNb.Validate()) } if errs.Empty() { return nil @@ -144,8 +156,9 @@ func (v Contact4) Validate() error { func (v CreditorPaymentActivationRequestV07) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.PmtInf.Validate()) + baseName := "CreditorPaymentActivationRequestV07" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".PmtInf", v.PmtInf.Validate()) if errs.Empty() { return nil } @@ -154,8 +167,9 @@ func (v CreditorPaymentActivationRequestV07) Validate() error { func (v CreditorPaymentActivationRequestV07TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.PmtInf.Validate()) + baseName := "CreditorPaymentActivationRequestV07TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".PmtInf", v.PmtInf.Validate()) if errs.Empty() { return nil } @@ -164,29 +178,30 @@ func (v CreditorPaymentActivationRequestV07TCH) Validate() error { func (v CreditTransferTransaction35) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtId.Validate()) - rtp.AddError(&errs, v.PmtTpInf.Validate()) + baseName := "CreditTransferTransaction35" + rtp.AddError(&errs, baseName+".PmtId", v.PmtId.Validate()) + rtp.AddError(&errs, baseName+".PmtTpInf", v.PmtTpInf.Validate()) if v.PmtCond != nil { - rtp.AddError(&errs, v.PmtCond.Validate()) + rtp.AddError(&errs, baseName+".PmtCond", v.PmtCond.Validate()) } - rtp.AddError(&errs, v.Amt.Validate()) - rtp.AddError(&errs, v.ChrgBr.Validate()) - rtp.AddError(&errs, v.CdtrAgt.Validate()) - rtp.AddError(&errs, v.Cdtr.Validate()) - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) + rtp.AddError(&errs, baseName+".ChrgBr", v.ChrgBr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) if v.UltmtCdtr != nil { - rtp.AddError(&errs, v.UltmtCdtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtCdtr", v.UltmtCdtr.Validate()) } if v.InstrForCdtrAgt != nil { for indx := range v.InstrForCdtrAgt { - rtp.AddError(&errs, v.InstrForCdtrAgt[indx].Validate()) + rtp.AddError(&errs, baseName+".InstrForCdtrAgt", v.InstrForCdtrAgt[indx].Validate()) } } if v.RltdRmtInf != nil { - rtp.AddError(&errs, v.RltdRmtInf.Validate()) + rtp.AddError(&errs, baseName+".RltdRmtInf", v.RltdRmtInf.Validate()) } if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -196,29 +211,30 @@ func (v CreditTransferTransaction35) Validate() error { func (v CreditTransferTransaction35TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtId.Validate()) - rtp.AddError(&errs, v.PmtTpInf.Validate()) + baseName := "CreditTransferTransaction35TCH" + rtp.AddError(&errs, baseName+".PmtId", v.PmtId.Validate()) + rtp.AddError(&errs, baseName+".PmtTpInf", v.PmtTpInf.Validate()) if v.PmtCond != nil { - rtp.AddError(&errs, v.PmtCond.Validate()) + rtp.AddError(&errs, baseName+".PmtCond", v.PmtCond.Validate()) } - rtp.AddError(&errs, v.Amt.Validate()) - rtp.AddError(&errs, v.ChrgBr.Validate()) - rtp.AddError(&errs, v.CdtrAgt.Validate()) - rtp.AddError(&errs, v.Cdtr.Validate()) - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) + rtp.AddError(&errs, baseName+".ChrgBr", v.ChrgBr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) if v.UltmtCdtr != nil { - rtp.AddError(&errs, v.UltmtCdtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtCdtr", v.UltmtCdtr.Validate()) } if v.InstrForCdtrAgt != nil { for indx := range v.InstrForCdtrAgt { - rtp.AddError(&errs, v.InstrForCdtrAgt[indx].Validate()) + rtp.AddError(&errs, baseName+".InstrForCdtrAgt", v.InstrForCdtrAgt[indx].Validate()) } } if v.RltdRmtInf != nil { - rtp.AddError(&errs, v.RltdRmtInf.Validate()) + rtp.AddError(&errs, baseName+".RltdRmtInf", v.RltdRmtInf.Validate()) } if v.RmtInf != nil { - rtp.AddError(&errs, v.RmtInf.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) } if errs.Empty() { return nil @@ -228,11 +244,12 @@ func (v CreditTransferTransaction35TCH) Validate() error { func (v DateAndDateTime2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DateAndDateTime2Choice" if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.DtTm != nil { - rtp.AddError(&errs, v.DtTm.Validate()) + rtp.AddError(&errs, baseName+".DtTm", v.DtTm.Validate()) } if errs.Empty() { return nil @@ -242,11 +259,12 @@ func (v DateAndDateTime2Choice) Validate() error { func (v DateAndDateTime2ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DateAndDateTime2ChoiceTCH" if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.DtTm != nil { - rtp.AddError(&errs, v.DtTm.Validate()) + rtp.AddError(&errs, baseName+".DtTm", v.DtTm.Validate()) } if errs.Empty() { return nil @@ -256,9 +274,10 @@ func (v DateAndDateTime2ChoiceTCH) Validate() error { func (v DateAndPlaceOfBirth1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.BirthDt.Validate()) - rtp.AddError(&errs, v.CityOfBirth.Validate()) - rtp.AddError(&errs, v.CtryOfBirth.Validate()) + baseName := "DateAndPlaceOfBirth1" + rtp.AddError(&errs, baseName+".BirthDt", v.BirthDt.Validate()) + rtp.AddError(&errs, baseName+".CityOfBirth", v.CityOfBirth.Validate()) + rtp.AddError(&errs, baseName+".CtryOfBirth", v.CtryOfBirth.Validate()) if errs.Empty() { return nil } @@ -267,8 +286,9 @@ func (v DateAndPlaceOfBirth1) Validate() error { func (v DiscountAmountAndType1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DiscountAmountAndType1" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -277,8 +297,9 @@ func (v DiscountAmountAndType1) Validate() error { func (v DiscountAmountAndType1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DiscountAmountAndType1TCH" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -287,8 +308,9 @@ func (v DiscountAmountAndType1TCH) Validate() error { func (v DiscountAmountType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -298,8 +320,9 @@ func (v DiscountAmountType1Choice) Validate() error { func (v DiscountAmountType1ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1ChoiceTCH" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -309,7 +332,8 @@ func (v DiscountAmountType1ChoiceTCH) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdtrPmtActvtnReq.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".CdtrPmtActvtnReq", v.CdtrPmtActvtnReq.Validate()) if errs.Empty() { return nil } @@ -318,7 +342,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -327,7 +352,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -336,7 +362,8 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v GenericAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -345,9 +372,10 @@ func (v GenericAccountIdentification1) Validate() error { func (v GenericOrganisationIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -357,9 +385,10 @@ func (v GenericOrganisationIdentification1) Validate() error { func (v GenericOrganisationIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -369,7 +398,8 @@ func (v GenericOrganisationIdentification1TCH) Validate() error { func (v GenericOrganisationIdentification1TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH2" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -378,9 +408,10 @@ func (v GenericOrganisationIdentification1TCH2) Validate() error { func (v GenericPersonIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericPersonIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if errs.Empty() { return nil @@ -390,10 +421,11 @@ func (v GenericPersonIdentification1) Validate() error { func (v GroupHeader78) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.NbOfTxs.Validate()) - rtp.AddError(&errs, v.InitgPty.Validate()) + baseName := "GroupHeader78" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".NbOfTxs", v.NbOfTxs.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) if errs.Empty() { return nil } @@ -402,10 +434,11 @@ func (v GroupHeader78) Validate() error { func (v GroupHeader78TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.NbOfTxs.Validate()) - rtp.AddError(&errs, v.InitgPty.Validate()) + baseName := "GroupHeader78TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".NbOfTxs", v.NbOfTxs.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) if errs.Empty() { return nil } @@ -414,8 +447,9 @@ func (v GroupHeader78TCH) Validate() error { func (v InstructionForCreditorAgent1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Cd.Validate()) - rtp.AddError(&errs, v.InstrInf.Validate()) + baseName := "InstructionForCreditorAgent1" + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) + rtp.AddError(&errs, baseName+".InstrInf", v.InstrInf.Validate()) if errs.Empty() { return nil } @@ -424,8 +458,9 @@ func (v InstructionForCreditorAgent1) Validate() error { func (v InstructionForCreditorAgent1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Cd.Validate()) - rtp.AddError(&errs, v.InstrInf.Validate()) + baseName := "InstructionForCreditorAgent1TCH" + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) + rtp.AddError(&errs, baseName+".InstrInf", v.InstrInf.Validate()) if errs.Empty() { return nil } @@ -434,8 +469,9 @@ func (v InstructionForCreditorAgent1TCH) Validate() error { func (v LocalInstrument2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "LocalInstrument2Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -445,8 +481,9 @@ func (v LocalInstrument2Choice) Validate() error { func (v LocalInstrument2ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "LocalInstrument2ChoiceTCH" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -456,12 +493,13 @@ func (v LocalInstrument2ChoiceTCH) Validate() error { func (v OrganisationIdentification29) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -472,8 +510,9 @@ func (v OrganisationIdentification29) Validate() error { func (v OrganisationIdentification29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29TCH" for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } if errs.Empty() { return nil @@ -483,7 +522,8 @@ func (v OrganisationIdentification29TCH) Validate() error { func (v OrganisationIdentification29TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.LEI.Validate()) + baseName := "OrganisationIdentification29TCH2" + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) if errs.Empty() { return nil } @@ -492,12 +532,13 @@ func (v OrganisationIdentification29TCH2) Validate() error { func (v OrganisationIdentification29TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29TCH3" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -508,7 +549,8 @@ func (v OrganisationIdentification29TCH3) Validate() error { func (v OrganisationIdentification29TCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Othr.Validate()) + baseName := "OrganisationIdentification29TCH4" + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) if errs.Empty() { return nil } @@ -517,8 +559,9 @@ func (v OrganisationIdentification29TCH4) Validate() error { func (v OrganisationIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentificationSchemeName1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -528,8 +571,9 @@ func (v OrganisationIdentificationSchemeName1Choice) Validate() error { func (v OrganisationIdentificationSchemeName1ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentificationSchemeName1ChoiceTCH" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -539,11 +583,12 @@ func (v OrganisationIdentificationSchemeName1ChoiceTCH) Validate() error { func (v Party38Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38Choice" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -553,8 +598,9 @@ func (v Party38Choice) Validate() error { func (v Party38ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -564,11 +610,12 @@ func (v Party38ChoiceTCH) Validate() error { func (v Party38ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH2" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -578,11 +625,12 @@ func (v Party38ChoiceTCH2) Validate() error { func (v Party38ChoiceTCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH3" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -592,8 +640,9 @@ func (v Party38ChoiceTCH3) Validate() error { func (v Party38ChoiceTCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH4" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -603,17 +652,18 @@ func (v Party38ChoiceTCH4) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -623,7 +673,8 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -632,12 +683,13 @@ func (v PartyIdentification135TCH) Validate() error { func (v PartyIdentification135TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH2" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -647,12 +699,13 @@ func (v PartyIdentification135TCH2) Validate() error { func (v PartyIdentification135TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH3" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -662,15 +715,16 @@ func (v PartyIdentification135TCH3) Validate() error { func (v PartyIdentification135TCH4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH4" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -680,7 +734,8 @@ func (v PartyIdentification135TCH4) Validate() error { func (v PartyIdentification135TCH5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "PartyIdentification135TCH5" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -689,9 +744,10 @@ func (v PartyIdentification135TCH5) Validate() error { func (v PaymentCondition1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AmtModAllwd.Validate()) - rtp.AddError(&errs, v.EarlyPmtAllwd.Validate()) - rtp.AddError(&errs, v.GrntedPmtReqd.Validate()) + baseName := "PaymentCondition1" + rtp.AddError(&errs, baseName+".AmtModAllwd", v.AmtModAllwd.Validate()) + rtp.AddError(&errs, baseName+".EarlyPmtAllwd", v.EarlyPmtAllwd.Validate()) + rtp.AddError(&errs, baseName+".GrntedPmtReqd", v.GrntedPmtReqd.Validate()) if errs.Empty() { return nil } @@ -700,12 +756,13 @@ func (v PaymentCondition1) Validate() error { func (v PaymentIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentIdentification6" if v.InstrId != nil { - rtp.AddError(&errs, v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) } - rtp.AddError(&errs, v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) if v.UETR != nil { - rtp.AddError(&errs, v.UETR.Validate()) + rtp.AddError(&errs, baseName+".UETR", v.UETR.Validate()) } if errs.Empty() { return nil @@ -715,9 +772,10 @@ func (v PaymentIdentification6) Validate() error { func (v PaymentCondition1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AmtModAllwd.Validate()) - rtp.AddError(&errs, v.EarlyPmtAllwd.Validate()) - rtp.AddError(&errs, v.GrntedPmtReqd.Validate()) + baseName := "PaymentCondition1TCH" + rtp.AddError(&errs, baseName+".AmtModAllwd", v.AmtModAllwd.Validate()) + rtp.AddError(&errs, baseName+".EarlyPmtAllwd", v.EarlyPmtAllwd.Validate()) + rtp.AddError(&errs, baseName+".GrntedPmtReqd", v.GrntedPmtReqd.Validate()) if errs.Empty() { return nil } @@ -726,17 +784,18 @@ func (v PaymentCondition1TCH) Validate() error { func (v PaymentInstruction31) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtInfId.Validate()) - rtp.AddError(&errs, v.PmtMtd.Validate()) - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) - rtp.AddError(&errs, v.XpryDt.Validate()) - rtp.AddError(&errs, v.Dbtr.Validate()) - rtp.AddError(&errs, v.DbtrAcct.Validate()) - rtp.AddError(&errs, v.DbtrAgt.Validate()) + baseName := "PaymentInstruction31" + rtp.AddError(&errs, baseName+".PmtInfId", v.PmtInfId.Validate()) + rtp.AddError(&errs, baseName+".PmtMtd", v.PmtMtd.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".XpryDt", v.XpryDt.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAgt", v.DbtrAgt.Validate()) if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } - rtp.AddError(&errs, v.CdtTrfTx.Validate()) + rtp.AddError(&errs, baseName+".CdtTrfTx", v.CdtTrfTx.Validate()) if errs.Empty() { return nil } @@ -745,17 +804,18 @@ func (v PaymentInstruction31) Validate() error { func (v PaymentInstruction31TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.PmtInfId.Validate()) - rtp.AddError(&errs, v.PmtMtd.Validate()) - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) - rtp.AddError(&errs, v.XpryDt.Validate()) - rtp.AddError(&errs, v.Dbtr.Validate()) - rtp.AddError(&errs, v.DbtrAcct.Validate()) - rtp.AddError(&errs, v.DbtrAgt.Validate()) + baseName := "PaymentInstruction31TCH" + rtp.AddError(&errs, baseName+".PmtInfId", v.PmtInfId.Validate()) + rtp.AddError(&errs, baseName+".PmtMtd", v.PmtMtd.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".XpryDt", v.XpryDt.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAgt", v.DbtrAgt.Validate()) if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } - rtp.AddError(&errs, v.CdtTrfTx.Validate()) + rtp.AddError(&errs, baseName+".CdtTrfTx", v.CdtTrfTx.Validate()) if errs.Empty() { return nil } @@ -764,9 +824,10 @@ func (v PaymentInstruction31TCH) Validate() error { func (v PaymentTypeInformation26) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SvcLvl.Validate()) - rtp.AddError(&errs, v.LclInstrm.Validate()) - rtp.AddError(&errs, v.CtgyPurp.Validate()) + baseName := "PaymentTypeInformation26" + rtp.AddError(&errs, baseName+".SvcLvl", v.SvcLvl.Validate()) + rtp.AddError(&errs, baseName+".LclInstrm", v.LclInstrm.Validate()) + rtp.AddError(&errs, baseName+".CtgyPurp", v.CtgyPurp.Validate()) if errs.Empty() { return nil } @@ -775,9 +836,10 @@ func (v PaymentTypeInformation26) Validate() error { func (v PaymentTypeInformation26TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.SvcLvl.Validate()) - rtp.AddError(&errs, v.LclInstrm.Validate()) - rtp.AddError(&errs, v.CtgyPurp.Validate()) + baseName := "PaymentTypeInformation26TCH" + rtp.AddError(&errs, baseName+".SvcLvl", v.SvcLvl.Validate()) + rtp.AddError(&errs, baseName+".LclInstrm", v.LclInstrm.Validate()) + rtp.AddError(&errs, baseName+".CtgyPurp", v.CtgyPurp.Validate()) if errs.Empty() { return nil } @@ -786,12 +848,13 @@ func (v PaymentTypeInformation26TCH) Validate() error { func (v PersonIdentification13) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -802,7 +865,8 @@ func (v PersonIdentification13) Validate() error { func (v PersonIdentification13TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13TCH" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -811,12 +875,13 @@ func (v PersonIdentification13TCH) Validate() error { func (v PersonIdentification13TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13TCH2" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -827,8 +892,9 @@ func (v PersonIdentification13TCH2) Validate() error { func (v PersonIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentificationSchemeName1Choice" if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -838,16 +904,17 @@ func (v PersonIdentificationSchemeName1Choice) Validate() error { func (v PostalAddress24) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -857,16 +924,17 @@ func (v PostalAddress24) Validate() error { func (v PostalAddress24TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.StrtNm.Validate()) + baseName := "PostalAddress24TCH" + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } - rtp.AddError(&errs, v.PstCd.Validate()) - rtp.AddError(&errs, v.TwnNm.Validate()) - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) if v.AdrLine != nil { - rtp.AddError(&errs, v.AdrLine.Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine.Validate()) } if errs.Empty() { return nil @@ -876,7 +944,8 @@ func (v PostalAddress24TCH) Validate() error { func (v ProxyAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "ProxyAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -885,7 +954,8 @@ func (v ProxyAccountIdentification1) Validate() error { func (v ProxyAccountIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "ProxyAccountIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -894,12 +964,13 @@ func (v ProxyAccountIdentification1TCH) Validate() error { func (v ReferredDocumentInformation7) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentInformation7" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } - rtp.AddError(&errs, v.Nb.Validate()) + rtp.AddError(&errs, baseName+".Nb", v.Nb.Validate()) if v.RltdDt != nil { - rtp.AddError(&errs, v.RltdDt.Validate()) + rtp.AddError(&errs, baseName+".RltdDt", v.RltdDt.Validate()) } if errs.Empty() { return nil @@ -909,12 +980,13 @@ func (v ReferredDocumentInformation7) Validate() error { func (v ReferredDocumentInformation7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentInformation7TCH" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } - rtp.AddError(&errs, v.Nb.Validate()) + rtp.AddError(&errs, baseName+".Nb", v.Nb.Validate()) if v.RltdDt != nil { - rtp.AddError(&errs, v.RltdDt.Validate()) + rtp.AddError(&errs, baseName+".RltdDt", v.RltdDt.Validate()) } if errs.Empty() { return nil @@ -924,7 +996,8 @@ func (v ReferredDocumentInformation7TCH) Validate() error { func (v ReferredDocumentType5) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "ReferredDocumentType5" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if errs.Empty() { return nil } @@ -933,11 +1006,12 @@ func (v ReferredDocumentType5) Validate() error { func (v ReferredDocumentType5Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentType5Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -947,11 +1021,12 @@ func (v ReferredDocumentType5Choice) Validate() error { func (v ReferredDocumentType5ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentType5ChoiceTCH" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -961,7 +1036,8 @@ func (v ReferredDocumentType5ChoiceTCH) Validate() error { func (v ReferredDocumentType5TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "ReferredDocumentType5TCH" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if errs.Empty() { return nil } @@ -970,9 +1046,10 @@ func (v ReferredDocumentType5TCH) Validate() error { func (v RemittanceAmount2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2" if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if errs.Empty() { @@ -983,9 +1060,10 @@ func (v RemittanceAmount2) Validate() error { func (v RemittanceAmount2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2TCH" if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if errs.Empty() { @@ -996,11 +1074,12 @@ func (v RemittanceAmount2TCH) Validate() error { func (v RemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation16" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } if v.Strd != nil { - rtp.AddError(&errs, v.Strd.Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd.Validate()) } if errs.Empty() { return nil @@ -1010,11 +1089,12 @@ func (v RemittanceInformation16) Validate() error { func (v RemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceInformation16TCH" if v.Ustrd != nil { - rtp.AddError(&errs, v.Ustrd.Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd.Validate()) } if v.Strd != nil { - rtp.AddError(&errs, v.Strd.Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd.Validate()) } if errs.Empty() { return nil @@ -1024,11 +1104,12 @@ func (v RemittanceInformation16TCH) Validate() error { func (v RemittanceLocation7) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceLocation7" if v.RmtId != nil { - rtp.AddError(&errs, v.RmtId.Validate()) + rtp.AddError(&errs, baseName+".RmtId", v.RmtId.Validate()) } if v.RmtLctnDtls != nil { - rtp.AddError(&errs, v.RmtLctnDtls.Validate()) + rtp.AddError(&errs, baseName+".RmtLctnDtls", v.RmtLctnDtls.Validate()) } if errs.Empty() { return nil @@ -1038,11 +1119,12 @@ func (v RemittanceLocation7) Validate() error { func (v RemittanceLocation7TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceLocation7TCH" if v.RmtId != nil { - rtp.AddError(&errs, v.RmtId.Validate()) + rtp.AddError(&errs, baseName+".RmtId", v.RmtId.Validate()) } if v.RmtLctnDtls != nil { - rtp.AddError(&errs, v.RmtLctnDtls.Validate()) + rtp.AddError(&errs, baseName+".RmtLctnDtls", v.RmtLctnDtls.Validate()) } if errs.Empty() { return nil @@ -1052,8 +1134,9 @@ func (v RemittanceLocation7TCH) Validate() error { func (v RemittanceLocationData1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Mtd.Validate()) - rtp.AddError(&errs, v.ElctrncAdr.Validate()) + baseName := "RemittanceLocationData1" + rtp.AddError(&errs, baseName+".Mtd", v.Mtd.Validate()) + rtp.AddError(&errs, baseName+".ElctrncAdr", v.ElctrncAdr.Validate()) if errs.Empty() { return nil } @@ -1062,8 +1145,9 @@ func (v RemittanceLocationData1) Validate() error { func (v RemittanceLocationData1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Mtd.Validate()) - rtp.AddError(&errs, v.ElctrncAdr.Validate()) + baseName := "RemittanceLocationData1TCH" + rtp.AddError(&errs, baseName+".Mtd", v.Mtd.Validate()) + rtp.AddError(&errs, baseName+".ElctrncAdr", v.ElctrncAdr.Validate()) if errs.Empty() { return nil } @@ -1072,8 +1156,9 @@ func (v RemittanceLocationData1TCH) Validate() error { func (v ServiceLevel8Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ServiceLevel8Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if errs.Empty() { return nil @@ -1083,19 +1168,20 @@ func (v ServiceLevel8Choice) Validate() error { func (v StructuredRemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16" if v.RfrdDocInf != nil { for indx := range v.RfrdDocInf { - rtp.AddError(&errs, v.RfrdDocInf[indx].Validate()) + rtp.AddError(&errs, baseName+".RfrdDocInf", v.RfrdDocInf[indx].Validate()) } } if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if v.Invcr != nil { - rtp.AddError(&errs, v.Invcr.Validate()) + rtp.AddError(&errs, baseName+".Invcr", v.Invcr.Validate()) } if v.Invcee != nil { - rtp.AddError(&errs, v.Invcee.Validate()) + rtp.AddError(&errs, baseName+".Invcee", v.Invcee.Validate()) } if errs.Empty() { return nil @@ -1105,19 +1191,20 @@ func (v StructuredRemittanceInformation16) Validate() error { func (v StructuredRemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16TCH" if v.RfrdDocInf != nil { for indx := range v.RfrdDocInf { - rtp.AddError(&errs, v.RfrdDocInf[indx].Validate()) + rtp.AddError(&errs, baseName+".RfrdDocInf", v.RfrdDocInf[indx].Validate()) } } if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if v.Invcr != nil { - rtp.AddError(&errs, v.Invcr.Validate()) + rtp.AddError(&errs, baseName+".Invcr", v.Invcr.Validate()) } if v.Invcee != nil { - rtp.AddError(&errs, v.Invcee.Validate()) + rtp.AddError(&errs, baseName+".Invcee", v.Invcee.Validate()) } if errs.Empty() { return nil @@ -1128,287 +1215,279 @@ func (v StructuredRemittanceInformation16TCH) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v CatePurpProp) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "BUSINESS", "CONSUMER")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "BUSINESS", "CONSUMER"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v ChargeBearerType1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "SLEV")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "SLEV"); err != nil { + return err } - return errs + return nil } func (v CountryCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{2,2}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{2,2}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"); err != nil { + return err + } + return nil } func (v DocumentType6Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CINV")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CINV"); err != nil { + return err } - return errs + return nil } func (v DocumentType6CodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CINV")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CINV"); err != nil { + return err } - return errs + return nil } func (v ExternalServiceLevel1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "SDVA")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "SDVA"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Instruction3CodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "PRTK", "RECI", "TKCM", "TKSG", "TKSP", "TKVE", "TKXP", "TOKN", "VLTK")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "PRTK", "RECI", "TKCM", "TKSG", "TKSP", "TKVE", "TKXP", "TOKN", "VLTK"); err != nil { + return err } - return errs + return nil } func (v LEIIdentifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`); err != nil { + return err } - return errs + return nil } func (v LocalProp) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "INTERMEDIARY", "IXB", "STANDARD", "ZELLE")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "INTERMEDIARY", "IXB", "STANDARD", "ZELLE"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v LocalPropTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "INTERMEDIARY", "IXB", "STANDARD", "ZELLE")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "INTERMEDIARY", "IXB", "STANDARD", "ZELLE"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max16Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 16)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 16); err != nil { + return err + } + return nil } func (v Max1NumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[1]{1,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[1]{1,1}`); err != nil { + return err } - return errs + return nil } func (v Max2048Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 2048)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 2048); err != nil { + return err + } + return nil } func (v Max2048TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 256)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 256); err != nil { + return err + } + return nil } func (v Max34Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 34)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 34); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v Max35TextTCH3) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH4) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "DSCT", "FULL")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "DSCT", "FULL"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max35TextTCH5) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CSCM")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CSCM"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max70Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 70)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 70); err != nil { + return err + } + return nil } func (v PaymentMethod7Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "TRF")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "TRF"); err != nil { + return err } - return errs + return nil } func (v PhoneNumber) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`); err != nil { + return err } - return errs + return nil } func (v RemittanceLocationMethod2Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "EMAL", "URID")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "EMAL", "URID"); err != nil { + return err } - return errs + return nil } func (v TrueFalseIndicator) Validate() error { - var errs base.ErrorList = base.ErrorList{} - if errs.Empty() { - return nil - } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/pain_014_001_07/validate.go b/gen/pain_014_001_07/validate.go index b68267f..6221dee 100644 --- a/gen/pain_014_001_07/validate.go +++ b/gen/pain_014_001_07/validate.go @@ -11,8 +11,9 @@ import ( func (v ActiveCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -22,8 +23,9 @@ func (v ActiveCurrencyAndAmount) Validate() error { func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -33,8 +35,9 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v AmountType4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AmountType4Choice" if v.InstdAmt != nil { - rtp.AddError(&errs, v.InstdAmt.Validate()) + rtp.AddError(&errs, baseName+".InstdAmt", v.InstdAmt.Validate()) } if errs.Empty() { return nil @@ -44,7 +47,8 @@ func (v AmountType4Choice) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -53,7 +57,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -62,7 +67,8 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -71,7 +77,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -80,9 +87,10 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v CreditorPaymentActivationRequestStatusReportV07) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.OrgnlGrpInfAndSts.Validate()) - rtp.AddError(&errs, v.OrgnlPmtInfAndSts.Validate()) + baseName := "CreditorPaymentActivationRequestStatusReportV07" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndSts", v.OrgnlGrpInfAndSts.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInfAndSts", v.OrgnlPmtInfAndSts.Validate()) if errs.Empty() { return nil } @@ -91,9 +99,10 @@ func (v CreditorPaymentActivationRequestStatusReportV07) Validate() error { func (v CreditorPaymentActivationRequestStatusReportV07TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.OrgnlGrpInfAndSts.Validate()) - rtp.AddError(&errs, v.OrgnlPmtInfAndSts.Validate()) + baseName := "CreditorPaymentActivationRequestStatusReportV07TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".OrgnlGrpInfAndSts", v.OrgnlGrpInfAndSts.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInfAndSts", v.OrgnlPmtInfAndSts.Validate()) if errs.Empty() { return nil } @@ -102,11 +111,12 @@ func (v CreditorPaymentActivationRequestStatusReportV07TCH) Validate() error { func (v DateAndDateTime2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DateAndDateTime2Choice" if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.DtTm != nil { - rtp.AddError(&errs, v.DtTm.Validate()) + rtp.AddError(&errs, baseName+".DtTm", v.DtTm.Validate()) } if errs.Empty() { return nil @@ -116,9 +126,10 @@ func (v DateAndDateTime2Choice) Validate() error { func (v DateAndPlaceOfBirth1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.BirthDt.Validate()) - rtp.AddError(&errs, v.CityOfBirth.Validate()) - rtp.AddError(&errs, v.CtryOfBirth.Validate()) + baseName := "DateAndPlaceOfBirth1" + rtp.AddError(&errs, baseName+".BirthDt", v.BirthDt.Validate()) + rtp.AddError(&errs, baseName+".CityOfBirth", v.CityOfBirth.Validate()) + rtp.AddError(&errs, baseName+".CtryOfBirth", v.CtryOfBirth.Validate()) if errs.Empty() { return nil } @@ -127,7 +138,8 @@ func (v DateAndPlaceOfBirth1) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdtrPmtActvtnReqStsRpt.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".CdtrPmtActvtnReqStsRpt", v.CdtrPmtActvtnReqStsRpt.Validate()) if errs.Empty() { return nil } @@ -136,7 +148,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -145,7 +158,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -154,7 +168,8 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v GenericOrganisationIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -163,7 +178,8 @@ func (v GenericOrganisationIdentification1) Validate() error { func (v GenericOrganisationIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -172,9 +188,10 @@ func (v GenericOrganisationIdentification1TCH) Validate() error { func (v GroupHeader87) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.InitgPty.Validate()) + baseName := "GroupHeader87" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) if errs.Empty() { return nil } @@ -183,9 +200,10 @@ func (v GroupHeader87) Validate() error { func (v GroupHeader87TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.InitgPty.Validate()) + baseName := "GroupHeader87TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) if errs.Empty() { return nil } @@ -194,11 +212,12 @@ func (v GroupHeader87TCH) Validate() error { func (v OrganisationIdentification29) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29" if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -208,7 +227,8 @@ func (v OrganisationIdentification29) Validate() error { func (v OrganisationIdentification29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Othr.Validate()) + baseName := "OrganisationIdentification29TCH" + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) if errs.Empty() { return nil } @@ -217,7 +237,8 @@ func (v OrganisationIdentification29TCH) Validate() error { func (v OrganisationIdentification29TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.LEI.Validate()) + baseName := "OrganisationIdentification29TCH2" + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) if errs.Empty() { return nil } @@ -226,10 +247,11 @@ func (v OrganisationIdentification29TCH2) Validate() error { func (v OriginalGroupInformation30) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlNbOfTxs.Validate()) + baseName := "OriginalGroupInformation30" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlNbOfTxs", v.OrgnlNbOfTxs.Validate()) if errs.Empty() { return nil } @@ -238,10 +260,11 @@ func (v OriginalGroupInformation30) Validate() error { func (v OriginalGroupInformation30TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlMsgId.Validate()) - rtp.AddError(&errs, v.OrgnlMsgNmId.Validate()) - rtp.AddError(&errs, v.OrgnlCreDtTm.Validate()) - rtp.AddError(&errs, v.OrgnlNbOfTxs.Validate()) + baseName := "OriginalGroupInformation30TCH" + rtp.AddError(&errs, baseName+".OrgnlMsgId", v.OrgnlMsgId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlMsgNmId", v.OrgnlMsgNmId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlCreDtTm", v.OrgnlCreDtTm.Validate()) + rtp.AddError(&errs, baseName+".OrgnlNbOfTxs", v.OrgnlNbOfTxs.Validate()) if errs.Empty() { return nil } @@ -250,8 +273,9 @@ func (v OriginalGroupInformation30TCH) Validate() error { func (v OriginalPaymentInstruction31) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlPmtInfId.Validate()) - rtp.AddError(&errs, v.TxInfAndSts.Validate()) + baseName := "OriginalPaymentInstruction31" + rtp.AddError(&errs, baseName+".OrgnlPmtInfId", v.OrgnlPmtInfId.Validate()) + rtp.AddError(&errs, baseName+".TxInfAndSts", v.TxInfAndSts.Validate()) if errs.Empty() { return nil } @@ -260,8 +284,9 @@ func (v OriginalPaymentInstruction31) Validate() error { func (v OriginalPaymentInstruction31TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.OrgnlPmtInfId.Validate()) - rtp.AddError(&errs, v.TxInfAndSts.Validate()) + baseName := "OriginalPaymentInstruction31TCH" + rtp.AddError(&errs, baseName+".OrgnlPmtInfId", v.OrgnlPmtInfId.Validate()) + rtp.AddError(&errs, baseName+".TxInfAndSts", v.TxInfAndSts.Validate()) if errs.Empty() { return nil } @@ -270,12 +295,13 @@ func (v OriginalPaymentInstruction31TCH) Validate() error { func (v OriginalTransactionReference29) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OriginalTransactionReference29" if v.Amt != nil { - rtp.AddError(&errs, v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) } - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) - rtp.AddError(&errs, v.CdtrAgt.Validate()) - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) if errs.Empty() { return nil } @@ -284,12 +310,13 @@ func (v OriginalTransactionReference29) Validate() error { func (v OriginalTransactionReference29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OriginalTransactionReference29TCH" if v.Amt != nil { - rtp.AddError(&errs, v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) } - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) - rtp.AddError(&errs, v.CdtrAgt.Validate()) - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) if errs.Empty() { return nil } @@ -298,11 +325,12 @@ func (v OriginalTransactionReference29TCH) Validate() error { func (v Party38Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38Choice" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -312,8 +340,9 @@ func (v Party38Choice) Validate() error { func (v Party38ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -323,11 +352,12 @@ func (v Party38ChoiceTCH) Validate() error { func (v Party38ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH2" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -337,11 +367,12 @@ func (v Party38ChoiceTCH2) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -351,7 +382,8 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -360,9 +392,10 @@ func (v PartyIdentification135TCH) Validate() error { func (v PartyIdentification135TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Nm.Validate()) + baseName := "PartyIdentification135TCH2" + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -372,9 +405,10 @@ func (v PartyIdentification135TCH2) Validate() error { func (v PaymentConditionStatus1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AccptdAmt.Validate()) - rtp.AddError(&errs, v.GrntedPmt.Validate()) - rtp.AddError(&errs, v.EarlyPmt.Validate()) + baseName := "PaymentConditionStatus1" + rtp.AddError(&errs, baseName+".AccptdAmt", v.AccptdAmt.Validate()) + rtp.AddError(&errs, baseName+".GrntedPmt", v.GrntedPmt.Validate()) + rtp.AddError(&errs, baseName+".EarlyPmt", v.EarlyPmt.Validate()) if errs.Empty() { return nil } @@ -383,9 +417,10 @@ func (v PaymentConditionStatus1) Validate() error { func (v PaymentConditionStatus1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.AccptdAmt.Validate()) - rtp.AddError(&errs, v.GrntedPmt.Validate()) - rtp.AddError(&errs, v.EarlyPmt.Validate()) + baseName := "PaymentConditionStatus1TCH" + rtp.AddError(&errs, baseName+".AccptdAmt", v.AccptdAmt.Validate()) + rtp.AddError(&errs, baseName+".GrntedPmt", v.GrntedPmt.Validate()) + rtp.AddError(&errs, baseName+".EarlyPmt", v.EarlyPmt.Validate()) if errs.Empty() { return nil } @@ -394,20 +429,21 @@ func (v PaymentConditionStatus1TCH) Validate() error { func (v PaymentTransaction104) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentTransaction104" if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.TxSts.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } if v.PmtCondSts != nil { - rtp.AddError(&errs, v.PmtCondSts.Validate()) + rtp.AddError(&errs, baseName+".PmtCondSts", v.PmtCondSts.Validate()) } - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) if errs.Empty() { return nil } @@ -416,20 +452,21 @@ func (v PaymentTransaction104) Validate() error { func (v PaymentTransaction104TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PaymentTransaction104TCH" if v.OrgnlEndToEndId != nil { - rtp.AddError(&errs, v.OrgnlEndToEndId.Validate()) + rtp.AddError(&errs, baseName+".OrgnlEndToEndId", v.OrgnlEndToEndId.Validate()) } if v.OrgnlUETR != nil { - rtp.AddError(&errs, v.OrgnlUETR.Validate()) + rtp.AddError(&errs, baseName+".OrgnlUETR", v.OrgnlUETR.Validate()) } - rtp.AddError(&errs, v.TxSts.Validate()) + rtp.AddError(&errs, baseName+".TxSts", v.TxSts.Validate()) if v.StsRsnInf != nil { - rtp.AddError(&errs, v.StsRsnInf.Validate()) + rtp.AddError(&errs, baseName+".StsRsnInf", v.StsRsnInf.Validate()) } if v.PmtCondSts != nil { - rtp.AddError(&errs, v.PmtCondSts.Validate()) + rtp.AddError(&errs, baseName+".PmtCondSts", v.PmtCondSts.Validate()) } - rtp.AddError(&errs, v.OrgnlTxRef.Validate()) + rtp.AddError(&errs, baseName+".OrgnlTxRef", v.OrgnlTxRef.Validate()) if errs.Empty() { return nil } @@ -438,7 +475,8 @@ func (v PaymentTransaction104TCH) Validate() error { func (v PersonIdentification13) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -447,7 +485,8 @@ func (v PersonIdentification13) Validate() error { func (v PersonIdentification13TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + baseName := "PersonIdentification13TCH" + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) if errs.Empty() { return nil } @@ -456,11 +495,12 @@ func (v PersonIdentification13TCH) Validate() error { func (v StatusReason6Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReason6Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -470,11 +510,12 @@ func (v StatusReason6Choice) Validate() error { func (v StatusReason6ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StatusReason6ChoiceTCH" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -484,9 +525,10 @@ func (v StatusReason6ChoiceTCH) Validate() error { func (v StatusReasonInformation12) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "StatusReasonInformation12" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -496,9 +538,10 @@ func (v StatusReasonInformation12) Validate() error { func (v StatusReasonInformation12TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Rsn.Validate()) + baseName := "StatusReasonInformation12TCH" + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -509,170 +552,168 @@ func (v StatusReasonInformation12TCH) Validate() error { // XSD SimpleType validations func (v ActiveCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v CountryCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{2,2}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{2,2}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"); err != nil { + return err + } + return nil } func (v ExternalPaymentTransactionStatus1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ACTC", "RJCT")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ACTC", "RJCT"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalStatusReason1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AC06", "AG01", "AG03", "AM09", "AM14", "BE04", "BE07", "MD07", "NARR")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AC06", "AG01", "AG03", "AM09", "AM14", "BE04", "BE07", "MD07", "NARR"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalStatusReason1CodeTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AC06", "AG01", "AG03", "AM09", "AM14", "BE04", "BE07", "CH11", "CUST", "DS04", "MD07", "NARR", "SL12")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AC06", "AG01", "AG03", "AM09", "AM14", "BE04", "BE07", "CH11", "CUST", "DS04", "MD07", "NARR", "SL12"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v LEIIdentifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`); err != nil { + return err } - return errs + return nil } func (v Max105Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 105)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 105); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max1NumericText) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[1]{1,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[1]{1,1}`); err != nil { + return err } - return errs + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v OrigMsgName) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "pain.013.001.07")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "pain.013.001.07"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v ProprietaryReasonCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "1100")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "1100"); err != nil { + return err } - return errs + return nil } func (v TrueFalseIndicator) Validate() error { - var errs base.ErrorList = base.ErrorList{} - if errs.Empty() { - return nil - } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/gen/remt_001_001_04/validate.go b/gen/remt_001_001_04/validate.go index 6cbd707..7190acf 100644 --- a/gen/remt_001_001_04/validate.go +++ b/gen/remt_001_001_04/validate.go @@ -13,8 +13,9 @@ import ( func (v AccountIdentification4Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AccountIdentification4Choice" if v.Othr != nil { - rtp.AddError(&errs, v.Othr.Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) } if errs.Empty() { return nil @@ -24,8 +25,9 @@ func (v AccountIdentification4Choice) Validate() error { func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ActiveOrHistoricCurrencyAndAmount" - rtp.AddError(&errs, v.Ccy.Validate()) + rtp.AddError(&errs, baseName+".Ccy", v.Ccy.Validate()) if errs.Empty() { return nil @@ -35,8 +37,9 @@ func (v ActiveOrHistoricCurrencyAndAmount) Validate() error { func (v AmountType3Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "AmountType3Choice" if v.InstdAmt != nil { - rtp.AddError(&errs, v.InstdAmt.Validate()) + rtp.AddError(&errs, baseName+".InstdAmt", v.InstdAmt.Validate()) } if errs.Empty() { return nil @@ -46,7 +49,8 @@ func (v AmountType3Choice) Validate() error { func (v BranchAndFinancialInstitutionIdentification6) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -55,7 +59,8 @@ func (v BranchAndFinancialInstitutionIdentification6) Validate() error { func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FinInstnId.Validate()) + baseName := "BranchAndFinancialInstitutionIdentification6TCH" + rtp.AddError(&errs, baseName+".FinInstnId", v.FinInstnId.Validate()) if errs.Empty() { return nil } @@ -64,7 +69,8 @@ func (v BranchAndFinancialInstitutionIdentification6TCH) Validate() error { func (v CashAccount38) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "CashAccount38" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -73,7 +79,8 @@ func (v CashAccount38) Validate() error { func (v ClearingSystemMemberIdentification2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -82,7 +89,8 @@ func (v ClearingSystemMemberIdentification2) Validate() error { func (v ClearingSystemMemberIdentification2TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MmbId.Validate()) + baseName := "ClearingSystemMemberIdentification2TCH" + rtp.AddError(&errs, baseName+".MmbId", v.MmbId.Validate()) if errs.Empty() { return nil } @@ -91,43 +99,44 @@ func (v ClearingSystemMemberIdentification2TCH) Validate() error { func (v Contact4) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Contact4" if v.NmPrfx != nil { - rtp.AddError(&errs, v.NmPrfx.Validate()) + rtp.AddError(&errs, baseName+".NmPrfx", v.NmPrfx.Validate()) } if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PhneNb != nil { - rtp.AddError(&errs, v.PhneNb.Validate()) + rtp.AddError(&errs, baseName+".PhneNb", v.PhneNb.Validate()) } if v.MobNb != nil { - rtp.AddError(&errs, v.MobNb.Validate()) + rtp.AddError(&errs, baseName+".MobNb", v.MobNb.Validate()) } if v.FaxNb != nil { - rtp.AddError(&errs, v.FaxNb.Validate()) + rtp.AddError(&errs, baseName+".FaxNb", v.FaxNb.Validate()) } if v.EmailAdr != nil { - rtp.AddError(&errs, v.EmailAdr.Validate()) + rtp.AddError(&errs, baseName+".EmailAdr", v.EmailAdr.Validate()) } if v.EmailPurp != nil { - rtp.AddError(&errs, v.EmailPurp.Validate()) + rtp.AddError(&errs, baseName+".EmailPurp", v.EmailPurp.Validate()) } if v.JobTitl != nil { - rtp.AddError(&errs, v.JobTitl.Validate()) + rtp.AddError(&errs, baseName+".JobTitl", v.JobTitl.Validate()) } if v.Rspnsblty != nil { - rtp.AddError(&errs, v.Rspnsblty.Validate()) + rtp.AddError(&errs, baseName+".Rspnsblty", v.Rspnsblty.Validate()) } if v.Dept != nil { - rtp.AddError(&errs, v.Dept.Validate()) + rtp.AddError(&errs, baseName+".Dept", v.Dept.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if v.PrefrdMtd != nil { - rtp.AddError(&errs, v.PrefrdMtd.Validate()) + rtp.AddError(&errs, baseName+".PrefrdMtd", v.PrefrdMtd.Validate()) } if errs.Empty() { return nil @@ -137,11 +146,12 @@ func (v Contact4) Validate() error { func (v CreditorReferenceInformation2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CreditorReferenceInformation2" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } if v.Ref != nil { - rtp.AddError(&errs, v.Ref.Validate()) + rtp.AddError(&errs, baseName+".Ref", v.Ref.Validate()) } if errs.Empty() { return nil @@ -151,11 +161,12 @@ func (v CreditorReferenceInformation2) Validate() error { func (v CreditorReferenceType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "CreditorReferenceType1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -165,9 +176,10 @@ func (v CreditorReferenceType1Choice) Validate() error { func (v CreditorReferenceType2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "CreditorReferenceType2" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -177,11 +189,12 @@ func (v CreditorReferenceType2) Validate() error { func (v DateAndDateTime2Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DateAndDateTime2Choice" if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.DtTm != nil { - rtp.AddError(&errs, v.DtTm.Validate()) + rtp.AddError(&errs, baseName+".DtTm", v.DtTm.Validate()) } if errs.Empty() { return nil @@ -191,9 +204,10 @@ func (v DateAndDateTime2Choice) Validate() error { func (v DateAndPlaceOfBirth1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.BirthDt.Validate()) - rtp.AddError(&errs, v.CityOfBirth.Validate()) - rtp.AddError(&errs, v.CtryOfBirth.Validate()) + baseName := "DateAndPlaceOfBirth1" + rtp.AddError(&errs, baseName+".BirthDt", v.BirthDt.Validate()) + rtp.AddError(&errs, baseName+".CityOfBirth", v.CityOfBirth.Validate()) + rtp.AddError(&errs, baseName+".CtryOfBirth", v.CtryOfBirth.Validate()) if errs.Empty() { return nil } @@ -202,8 +216,9 @@ func (v DateAndPlaceOfBirth1) Validate() error { func (v DatePeriod2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.FrDt.Validate()) - rtp.AddError(&errs, v.ToDt.Validate()) + baseName := "DatePeriod2" + rtp.AddError(&errs, baseName+".FrDt", v.FrDt.Validate()) + rtp.AddError(&errs, baseName+".ToDt", v.ToDt.Validate()) if errs.Empty() { return nil } @@ -212,10 +227,11 @@ func (v DatePeriod2) Validate() error { func (v DiscountAmountAndType1) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountAndType1" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } - rtp.AddError(&errs, v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -224,11 +240,12 @@ func (v DiscountAmountAndType1) Validate() error { func (v DiscountAmountType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DiscountAmountType1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -238,15 +255,16 @@ func (v DiscountAmountType1Choice) Validate() error { func (v DocumentAdjustment1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "DocumentAdjustment1" + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if v.CdtDbtInd != nil { - rtp.AddError(&errs, v.CdtDbtInd.Validate()) + rtp.AddError(&errs, baseName+".CdtDbtInd", v.CdtDbtInd.Validate()) } if v.Rsn != nil { - rtp.AddError(&errs, v.Rsn.Validate()) + rtp.AddError(&errs, baseName+".Rsn", v.Rsn.Validate()) } if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -256,14 +274,15 @@ func (v DocumentAdjustment1) Validate() error { func (v DocumentLineIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DocumentLineIdentification1" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } if v.Nb != nil { - rtp.AddError(&errs, v.Nb.Validate()) + rtp.AddError(&errs, baseName+".Nb", v.Nb.Validate()) } if v.RltdDt != nil { - rtp.AddError(&errs, v.RltdDt.Validate()) + rtp.AddError(&errs, baseName+".RltdDt", v.RltdDt.Validate()) } if errs.Empty() { return nil @@ -273,14 +292,15 @@ func (v DocumentLineIdentification1) Validate() error { func (v DocumentLineInformation1) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DocumentLineInformation1" for indx := range v.Id { - rtp.AddError(&errs, v.Id[indx].Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id[indx].Validate()) } if v.Desc != nil { - rtp.AddError(&errs, v.Desc.Validate()) + rtp.AddError(&errs, baseName+".Desc", v.Desc.Validate()) } if v.Amt != nil { - rtp.AddError(&errs, v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) } if errs.Empty() { return nil @@ -290,9 +310,10 @@ func (v DocumentLineInformation1) Validate() error { func (v DocumentLineType1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "DocumentLineType1" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -302,11 +323,12 @@ func (v DocumentLineType1) Validate() error { func (v DocumentLineType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "DocumentLineType1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -316,7 +338,8 @@ func (v DocumentLineType1Choice) Validate() error { func (v DocumentTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RmtAdvc.Validate()) + baseName := "DocumentTCH" + rtp.AddError(&errs, baseName+".RmtAdvc", v.RmtAdvc.Validate()) if errs.Empty() { return nil } @@ -325,7 +348,8 @@ func (v DocumentTCH) Validate() error { func (v FinancialInstitutionIdentification18) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -334,7 +358,8 @@ func (v FinancialInstitutionIdentification18) Validate() error { func (v FinancialInstitutionIdentification18TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ClrSysMmbId.Validate()) + baseName := "FinancialInstitutionIdentification18TCH" + rtp.AddError(&errs, baseName+".ClrSysMmbId", v.ClrSysMmbId.Validate()) if errs.Empty() { return nil } @@ -343,27 +368,28 @@ func (v FinancialInstitutionIdentification18TCH) Validate() error { func (v Garnishment3) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) + baseName := "Garnishment3" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) if v.Grnshee != nil { - rtp.AddError(&errs, v.Grnshee.Validate()) + rtp.AddError(&errs, baseName+".Grnshee", v.Grnshee.Validate()) } if v.GrnshmtAdmstr != nil { - rtp.AddError(&errs, v.GrnshmtAdmstr.Validate()) + rtp.AddError(&errs, baseName+".GrnshmtAdmstr", v.GrnshmtAdmstr.Validate()) } if v.RefNb != nil { - rtp.AddError(&errs, v.RefNb.Validate()) + rtp.AddError(&errs, baseName+".RefNb", v.RefNb.Validate()) } if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.RmtdAmt != nil { - rtp.AddError(&errs, v.RmtdAmt.Validate()) + rtp.AddError(&errs, baseName+".RmtdAmt", v.RmtdAmt.Validate()) } if v.FmlyMdclInsrncInd != nil { - rtp.AddError(&errs, v.FmlyMdclInsrncInd.Validate()) + rtp.AddError(&errs, baseName+".FmlyMdclInsrncInd", v.FmlyMdclInsrncInd.Validate()) } if v.MplyeeTermntnInd != nil { - rtp.AddError(&errs, v.MplyeeTermntnInd.Validate()) + rtp.AddError(&errs, baseName+".MplyeeTermntnInd", v.MplyeeTermntnInd.Validate()) } if errs.Empty() { return nil @@ -373,27 +399,28 @@ func (v Garnishment3) Validate() error { func (v Garnishment3TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Tp.Validate()) + baseName := "Garnishment3TCH" + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) if v.Grnshee != nil { - rtp.AddError(&errs, v.Grnshee.Validate()) + rtp.AddError(&errs, baseName+".Grnshee", v.Grnshee.Validate()) } if v.GrnshmtAdmstr != nil { - rtp.AddError(&errs, v.GrnshmtAdmstr.Validate()) + rtp.AddError(&errs, baseName+".GrnshmtAdmstr", v.GrnshmtAdmstr.Validate()) } if v.RefNb != nil { - rtp.AddError(&errs, v.RefNb.Validate()) + rtp.AddError(&errs, baseName+".RefNb", v.RefNb.Validate()) } if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.RmtdAmt != nil { - rtp.AddError(&errs, v.RmtdAmt.Validate()) + rtp.AddError(&errs, baseName+".RmtdAmt", v.RmtdAmt.Validate()) } if v.FmlyMdclInsrncInd != nil { - rtp.AddError(&errs, v.FmlyMdclInsrncInd.Validate()) + rtp.AddError(&errs, baseName+".FmlyMdclInsrncInd", v.FmlyMdclInsrncInd.Validate()) } if v.MplyeeTermntnInd != nil { - rtp.AddError(&errs, v.MplyeeTermntnInd.Validate()) + rtp.AddError(&errs, baseName+".MplyeeTermntnInd", v.MplyeeTermntnInd.Validate()) } if errs.Empty() { return nil @@ -403,9 +430,10 @@ func (v Garnishment3TCH) Validate() error { func (v GarnishmentType1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "GarnishmentType1" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -415,11 +443,12 @@ func (v GarnishmentType1) Validate() error { func (v GarnishmentType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "GarnishmentType1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -429,7 +458,8 @@ func (v GarnishmentType1Choice) Validate() error { func (v GenericAccountIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericAccountIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -438,12 +468,13 @@ func (v GenericAccountIdentification1) Validate() error { func (v GenericOrganisationIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -453,7 +484,8 @@ func (v GenericOrganisationIdentification1) Validate() error { func (v GenericOrganisationIdentification1TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -462,12 +494,13 @@ func (v GenericOrganisationIdentification1TCH) Validate() error { func (v GenericOrganisationIdentification1TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericOrganisationIdentification1TCH2" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -477,12 +510,13 @@ func (v GenericOrganisationIdentification1TCH2) Validate() error { func (v GenericPersonIdentification1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "GenericPersonIdentification1" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if v.SchmeNm != nil { - rtp.AddError(&errs, v.SchmeNm.Validate()) + rtp.AddError(&errs, baseName+".SchmeNm", v.SchmeNm.Validate()) } if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -492,10 +526,11 @@ func (v GenericPersonIdentification1) Validate() error { func (v GroupHeader79) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.InitgPty.Validate()) - rtp.AddError(&errs, v.MsgRcpt.Validate()) + baseName := "GroupHeader79" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) + rtp.AddError(&errs, baseName+".MsgRcpt", v.MsgRcpt.Validate()) if errs.Empty() { return nil } @@ -504,10 +539,11 @@ func (v GroupHeader79) Validate() error { func (v GroupHeader79TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.MsgId.Validate()) - rtp.AddError(&errs, v.CreDtTm.Validate()) - rtp.AddError(&errs, v.InitgPty.Validate()) - rtp.AddError(&errs, v.MsgRcpt.Validate()) + baseName := "GroupHeader79TCH" + rtp.AddError(&errs, baseName+".MsgId", v.MsgId.Validate()) + rtp.AddError(&errs, baseName+".CreDtTm", v.CreDtTm.Validate()) + rtp.AddError(&errs, baseName+".InitgPty", v.InitgPty.Validate()) + rtp.AddError(&errs, baseName+".MsgRcpt", v.MsgRcpt.Validate()) if errs.Empty() { return nil } @@ -516,15 +552,16 @@ func (v GroupHeader79TCH) Validate() error { func (v OrganisationIdentification29) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29" if v.AnyBIC != nil { - rtp.AddError(&errs, v.AnyBIC.Validate()) + rtp.AddError(&errs, baseName+".AnyBIC", v.AnyBIC.Validate()) } if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -535,7 +572,8 @@ func (v OrganisationIdentification29) Validate() error { func (v OrganisationIdentification29TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Othr.Validate()) + baseName := "OrganisationIdentification29TCH" + rtp.AddError(&errs, baseName+".Othr", v.Othr.Validate()) if errs.Empty() { return nil } @@ -544,15 +582,16 @@ func (v OrganisationIdentification29TCH) Validate() error { func (v OrganisationIdentification29TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentification29TCH2" if v.AnyBIC != nil { - rtp.AddError(&errs, v.AnyBIC.Validate()) + rtp.AddError(&errs, baseName+".AnyBIC", v.AnyBIC.Validate()) } if v.LEI != nil { - rtp.AddError(&errs, v.LEI.Validate()) + rtp.AddError(&errs, baseName+".LEI", v.LEI.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -563,11 +602,12 @@ func (v OrganisationIdentification29TCH2) Validate() error { func (v OrganisationIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "OrganisationIdentificationSchemeName1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -577,28 +617,29 @@ func (v OrganisationIdentificationSchemeName1Choice) Validate() error { func (v OriginalPaymentInformation8) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Refs.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "OriginalPaymentInformation8" + rtp.AddError(&errs, baseName+".Refs", v.Refs.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if v.ReqdExctnDt != nil { - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) } if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.DbtrAcct != nil { - rtp.AddError(&errs, v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) } if v.DbtrAgt != nil { - rtp.AddError(&errs, v.DbtrAgt.Validate()) + rtp.AddError(&errs, baseName+".DbtrAgt", v.DbtrAgt.Validate()) } if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if v.CdtrAcct != nil { - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) } if v.CdtrAgt != nil { - rtp.AddError(&errs, v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) } if errs.Empty() { return nil @@ -608,28 +649,29 @@ func (v OriginalPaymentInformation8) Validate() error { func (v OriginalPaymentInformation8TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Refs.Validate()) - rtp.AddError(&errs, v.Amt.Validate()) + baseName := "OriginalPaymentInformation8TCH" + rtp.AddError(&errs, baseName+".Refs", v.Refs.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if v.ReqdExctnDt != nil { - rtp.AddError(&errs, v.ReqdExctnDt.Validate()) + rtp.AddError(&errs, baseName+".ReqdExctnDt", v.ReqdExctnDt.Validate()) } if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.DbtrAcct != nil { - rtp.AddError(&errs, v.DbtrAcct.Validate()) + rtp.AddError(&errs, baseName+".DbtrAcct", v.DbtrAcct.Validate()) } if v.DbtrAgt != nil { - rtp.AddError(&errs, v.DbtrAgt.Validate()) + rtp.AddError(&errs, baseName+".DbtrAgt", v.DbtrAgt.Validate()) } if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if v.CdtrAcct != nil { - rtp.AddError(&errs, v.CdtrAcct.Validate()) + rtp.AddError(&errs, baseName+".CdtrAcct", v.CdtrAcct.Validate()) } if v.CdtrAgt != nil { - rtp.AddError(&errs, v.CdtrAgt.Validate()) + rtp.AddError(&errs, baseName+".CdtrAgt", v.CdtrAgt.Validate()) } if errs.Empty() { return nil @@ -639,9 +681,10 @@ func (v OriginalPaymentInformation8TCH) Validate() error { func (v OtherContact1) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.ChanlTp.Validate()) + baseName := "OtherContact1" + rtp.AddError(&errs, baseName+".ChanlTp", v.ChanlTp.Validate()) if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if errs.Empty() { return nil @@ -651,11 +694,12 @@ func (v OtherContact1) Validate() error { func (v Party38Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38Choice" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -665,8 +709,9 @@ func (v Party38Choice) Validate() error { func (v Party38ChoiceTCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if errs.Empty() { return nil @@ -676,11 +721,12 @@ func (v Party38ChoiceTCH) Validate() error { func (v Party38ChoiceTCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "Party38ChoiceTCH2" if v.OrgId != nil { - rtp.AddError(&errs, v.OrgId.Validate()) + rtp.AddError(&errs, baseName+".OrgId", v.OrgId.Validate()) } if v.PrvtId != nil { - rtp.AddError(&errs, v.PrvtId.Validate()) + rtp.AddError(&errs, baseName+".PrvtId", v.PrvtId.Validate()) } if errs.Empty() { return nil @@ -690,20 +736,21 @@ func (v Party38ChoiceTCH2) Validate() error { func (v PartyIdentification135) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtryOfRes != nil { - rtp.AddError(&errs, v.CtryOfRes.Validate()) + rtp.AddError(&errs, baseName+".CtryOfRes", v.CtryOfRes.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -713,7 +760,8 @@ func (v PartyIdentification135) Validate() error { func (v PartyIdentification135TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.Id.Validate()) + baseName := "PartyIdentification135TCH" + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) if errs.Empty() { return nil } @@ -722,20 +770,21 @@ func (v PartyIdentification135TCH) Validate() error { func (v PartyIdentification135TCH2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH2" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if v.PstlAdr != nil { - rtp.AddError(&errs, v.PstlAdr.Validate()) + rtp.AddError(&errs, baseName+".PstlAdr", v.PstlAdr.Validate()) } if v.Id != nil { - rtp.AddError(&errs, v.Id.Validate()) + rtp.AddError(&errs, baseName+".Id", v.Id.Validate()) } if v.CtryOfRes != nil { - rtp.AddError(&errs, v.CtryOfRes.Validate()) + rtp.AddError(&errs, baseName+".CtryOfRes", v.CtryOfRes.Validate()) } if v.CtctDtls != nil { - rtp.AddError(&errs, v.CtctDtls.Validate()) + rtp.AddError(&errs, baseName+".CtctDtls", v.CtctDtls.Validate()) } if errs.Empty() { return nil @@ -745,8 +794,9 @@ func (v PartyIdentification135TCH2) Validate() error { func (v PartyIdentification135TCH3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PartyIdentification135TCH3" if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if errs.Empty() { return nil @@ -756,12 +806,13 @@ func (v PartyIdentification135TCH3) Validate() error { func (v PersonIdentification13) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentification13" if v.DtAndPlcOfBirth != nil { - rtp.AddError(&errs, v.DtAndPlcOfBirth.Validate()) + rtp.AddError(&errs, baseName+".DtAndPlcOfBirth", v.DtAndPlcOfBirth.Validate()) } if v.Othr != nil { for indx := range v.Othr { - rtp.AddError(&errs, v.Othr[indx].Validate()) + rtp.AddError(&errs, baseName+".Othr", v.Othr[indx].Validate()) } } if errs.Empty() { @@ -772,11 +823,12 @@ func (v PersonIdentification13) Validate() error { func (v PersonIdentificationSchemeName1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PersonIdentificationSchemeName1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -786,27 +838,28 @@ func (v PersonIdentificationSchemeName1Choice) Validate() error { func (v PostalAddress24) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "PostalAddress24" if v.StrtNm != nil { - rtp.AddError(&errs, v.StrtNm.Validate()) + rtp.AddError(&errs, baseName+".StrtNm", v.StrtNm.Validate()) } if v.BldgNb != nil { - rtp.AddError(&errs, v.BldgNb.Validate()) + rtp.AddError(&errs, baseName+".BldgNb", v.BldgNb.Validate()) } if v.PstCd != nil { - rtp.AddError(&errs, v.PstCd.Validate()) + rtp.AddError(&errs, baseName+".PstCd", v.PstCd.Validate()) } if v.TwnNm != nil { - rtp.AddError(&errs, v.TwnNm.Validate()) + rtp.AddError(&errs, baseName+".TwnNm", v.TwnNm.Validate()) } if v.CtrySubDvsn != nil { - rtp.AddError(&errs, v.CtrySubDvsn.Validate()) + rtp.AddError(&errs, baseName+".CtrySubDvsn", v.CtrySubDvsn.Validate()) } if v.Ctry != nil { - rtp.AddError(&errs, v.Ctry.Validate()) + rtp.AddError(&errs, baseName+".Ctry", v.Ctry.Validate()) } if v.AdrLine != nil { for indx := range v.AdrLine { - rtp.AddError(&errs, v.AdrLine[indx].Validate()) + rtp.AddError(&errs, baseName+".AdrLine", v.AdrLine[indx].Validate()) } } if errs.Empty() { @@ -817,18 +870,19 @@ func (v PostalAddress24) Validate() error { func (v ReferredDocumentInformation7) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentInformation7" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } if v.Nb != nil { - rtp.AddError(&errs, v.Nb.Validate()) + rtp.AddError(&errs, baseName+".Nb", v.Nb.Validate()) } if v.RltdDt != nil { - rtp.AddError(&errs, v.RltdDt.Validate()) + rtp.AddError(&errs, baseName+".RltdDt", v.RltdDt.Validate()) } if v.LineDtls != nil { for indx := range v.LineDtls { - rtp.AddError(&errs, v.LineDtls[indx].Validate()) + rtp.AddError(&errs, baseName+".LineDtls", v.LineDtls[indx].Validate()) } } if errs.Empty() { @@ -839,11 +893,12 @@ func (v ReferredDocumentInformation7) Validate() error { func (v ReferredDocumentType3Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "ReferredDocumentType3Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -853,9 +908,10 @@ func (v ReferredDocumentType3Choice) Validate() error { func (v ReferredDocumentType4) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.CdOrPrtry.Validate()) + baseName := "ReferredDocumentType4" + rtp.AddError(&errs, baseName+".CdOrPrtry", v.CdOrPrtry.Validate()) if v.Issr != nil { - rtp.AddError(&errs, v.Issr.Validate()) + rtp.AddError(&errs, baseName+".Issr", v.Issr.Validate()) } if errs.Empty() { return nil @@ -865,8 +921,9 @@ func (v ReferredDocumentType4) Validate() error { func (v RemittanceAdviceV04) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.RmtInf.Validate()) + baseName := "RemittanceAdviceV04" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) if errs.Empty() { return nil } @@ -875,8 +932,9 @@ func (v RemittanceAdviceV04) Validate() error { func (v RemittanceAdviceV04TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.GrpHdr.Validate()) - rtp.AddError(&errs, v.RmtInf.Validate()) + baseName := "RemittanceAdviceV04TCH" + rtp.AddError(&errs, baseName+".GrpHdr", v.GrpHdr.Validate()) + rtp.AddError(&errs, baseName+".RmtInf", v.RmtInf.Validate()) if errs.Empty() { return nil } @@ -885,29 +943,30 @@ func (v RemittanceAdviceV04TCH) Validate() error { func (v RemittanceAmount2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount2" if v.DuePyblAmt != nil { - rtp.AddError(&errs, v.DuePyblAmt.Validate()) + rtp.AddError(&errs, baseName+".DuePyblAmt", v.DuePyblAmt.Validate()) } if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if v.CdtNoteAmt != nil { - rtp.AddError(&errs, v.CdtNoteAmt.Validate()) + rtp.AddError(&errs, baseName+".CdtNoteAmt", v.CdtNoteAmt.Validate()) } if v.TaxAmt != nil { for indx := range v.TaxAmt { - rtp.AddError(&errs, v.TaxAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".TaxAmt", v.TaxAmt[indx].Validate()) } } if v.AdjstmntAmtAndRsn != nil { for indx := range v.AdjstmntAmtAndRsn { - rtp.AddError(&errs, v.AdjstmntAmtAndRsn[indx].Validate()) + rtp.AddError(&errs, baseName+".AdjstmntAmtAndRsn", v.AdjstmntAmtAndRsn[indx].Validate()) } } if v.RmtdAmt != nil { - rtp.AddError(&errs, v.RmtdAmt.Validate()) + rtp.AddError(&errs, baseName+".RmtdAmt", v.RmtdAmt.Validate()) } if errs.Empty() { return nil @@ -917,29 +976,30 @@ func (v RemittanceAmount2) Validate() error { func (v RemittanceAmount3) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "RemittanceAmount3" if v.DuePyblAmt != nil { - rtp.AddError(&errs, v.DuePyblAmt.Validate()) + rtp.AddError(&errs, baseName+".DuePyblAmt", v.DuePyblAmt.Validate()) } if v.DscntApldAmt != nil { for indx := range v.DscntApldAmt { - rtp.AddError(&errs, v.DscntApldAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".DscntApldAmt", v.DscntApldAmt[indx].Validate()) } } if v.CdtNoteAmt != nil { - rtp.AddError(&errs, v.CdtNoteAmt.Validate()) + rtp.AddError(&errs, baseName+".CdtNoteAmt", v.CdtNoteAmt.Validate()) } if v.TaxAmt != nil { for indx := range v.TaxAmt { - rtp.AddError(&errs, v.TaxAmt[indx].Validate()) + rtp.AddError(&errs, baseName+".TaxAmt", v.TaxAmt[indx].Validate()) } } if v.AdjstmntAmtAndRsn != nil { for indx := range v.AdjstmntAmtAndRsn { - rtp.AddError(&errs, v.AdjstmntAmtAndRsn[indx].Validate()) + rtp.AddError(&errs, baseName+".AdjstmntAmtAndRsn", v.AdjstmntAmtAndRsn[indx].Validate()) } } if v.RmtdAmt != nil { - rtp.AddError(&errs, v.RmtdAmt.Validate()) + rtp.AddError(&errs, baseName+".RmtdAmt", v.RmtdAmt.Validate()) } if errs.Empty() { return nil @@ -949,18 +1009,19 @@ func (v RemittanceAmount3) Validate() error { func (v RemittanceInformation19) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RmtId.Validate()) + baseName := "RemittanceInformation19" + rtp.AddError(&errs, baseName+".RmtId", v.RmtId.Validate()) if v.Ustrd != nil { for indx := range v.Ustrd { - rtp.AddError(&errs, v.Ustrd[indx].Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd[indx].Validate()) } } if v.Strd != nil { for indx := range v.Strd { - rtp.AddError(&errs, v.Strd[indx].Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd[indx].Validate()) } } - rtp.AddError(&errs, v.OrgnlPmtInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInf", v.OrgnlPmtInf.Validate()) if errs.Empty() { return nil } @@ -969,18 +1030,19 @@ func (v RemittanceInformation19) Validate() error { func (v RemittanceInformation19TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, v.RmtId.Validate()) + baseName := "RemittanceInformation19TCH" + rtp.AddError(&errs, baseName+".RmtId", v.RmtId.Validate()) if v.Ustrd != nil { for indx := range v.Ustrd { - rtp.AddError(&errs, v.Ustrd[indx].Validate()) + rtp.AddError(&errs, baseName+".Ustrd", v.Ustrd[indx].Validate()) } } if v.Strd != nil { for indx := range v.Strd { - rtp.AddError(&errs, v.Strd[indx].Validate()) + rtp.AddError(&errs, baseName+".Strd", v.Strd[indx].Validate()) } } - rtp.AddError(&errs, v.OrgnlPmtInf.Validate()) + rtp.AddError(&errs, baseName+".OrgnlPmtInf", v.OrgnlPmtInf.Validate()) if errs.Empty() { return nil } @@ -989,32 +1051,33 @@ func (v RemittanceInformation19TCH) Validate() error { func (v StructuredRemittanceInformation16) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16" if v.RfrdDocInf != nil { for indx := range v.RfrdDocInf { - rtp.AddError(&errs, v.RfrdDocInf[indx].Validate()) + rtp.AddError(&errs, baseName+".RfrdDocInf", v.RfrdDocInf[indx].Validate()) } } if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if v.CdtrRefInf != nil { - rtp.AddError(&errs, v.CdtrRefInf.Validate()) + rtp.AddError(&errs, baseName+".CdtrRefInf", v.CdtrRefInf.Validate()) } if v.Invcr != nil { - rtp.AddError(&errs, v.Invcr.Validate()) + rtp.AddError(&errs, baseName+".Invcr", v.Invcr.Validate()) } if v.Invcee != nil { - rtp.AddError(&errs, v.Invcee.Validate()) + rtp.AddError(&errs, baseName+".Invcee", v.Invcee.Validate()) } if v.TaxRmt != nil { - rtp.AddError(&errs, v.TaxRmt.Validate()) + rtp.AddError(&errs, baseName+".TaxRmt", v.TaxRmt.Validate()) } if v.GrnshmtRmt != nil { - rtp.AddError(&errs, v.GrnshmtRmt.Validate()) + rtp.AddError(&errs, baseName+".GrnshmtRmt", v.GrnshmtRmt.Validate()) } if v.AddtlRmtInf != nil { for indx := range v.AddtlRmtInf { - rtp.AddError(&errs, v.AddtlRmtInf[indx].Validate()) + rtp.AddError(&errs, baseName+".AddtlRmtInf", v.AddtlRmtInf[indx].Validate()) } } if errs.Empty() { @@ -1025,32 +1088,33 @@ func (v StructuredRemittanceInformation16) Validate() error { func (v StructuredRemittanceInformation16TCH) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "StructuredRemittanceInformation16TCH" if v.RfrdDocInf != nil { for indx := range v.RfrdDocInf { - rtp.AddError(&errs, v.RfrdDocInf[indx].Validate()) + rtp.AddError(&errs, baseName+".RfrdDocInf", v.RfrdDocInf[indx].Validate()) } } if v.RfrdDocAmt != nil { - rtp.AddError(&errs, v.RfrdDocAmt.Validate()) + rtp.AddError(&errs, baseName+".RfrdDocAmt", v.RfrdDocAmt.Validate()) } if v.CdtrRefInf != nil { - rtp.AddError(&errs, v.CdtrRefInf.Validate()) + rtp.AddError(&errs, baseName+".CdtrRefInf", v.CdtrRefInf.Validate()) } if v.Invcr != nil { - rtp.AddError(&errs, v.Invcr.Validate()) + rtp.AddError(&errs, baseName+".Invcr", v.Invcr.Validate()) } if v.Invcee != nil { - rtp.AddError(&errs, v.Invcee.Validate()) + rtp.AddError(&errs, baseName+".Invcee", v.Invcee.Validate()) } if v.TaxRmt != nil { - rtp.AddError(&errs, v.TaxRmt.Validate()) + rtp.AddError(&errs, baseName+".TaxRmt", v.TaxRmt.Validate()) } if v.GrnshmtRmt != nil { - rtp.AddError(&errs, v.GrnshmtRmt.Validate()) + rtp.AddError(&errs, baseName+".GrnshmtRmt", v.GrnshmtRmt.Validate()) } if v.AddtlRmtInf != nil { for indx := range v.AddtlRmtInf { - rtp.AddError(&errs, v.AddtlRmtInf[indx].Validate()) + rtp.AddError(&errs, baseName+".AddtlRmtInf", v.AddtlRmtInf[indx].Validate()) } } if errs.Empty() { @@ -1061,18 +1125,19 @@ func (v StructuredRemittanceInformation16TCH) Validate() error { func (v TaxAmount2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxAmount2" if v.Rate != nil { - rtp.AddError(&errs, v.Rate.Validate()) + rtp.AddError(&errs, baseName+".Rate", v.Rate.Validate()) } if v.TaxblBaseAmt != nil { - rtp.AddError(&errs, v.TaxblBaseAmt.Validate()) + rtp.AddError(&errs, baseName+".TaxblBaseAmt", v.TaxblBaseAmt.Validate()) } if v.TtlAmt != nil { - rtp.AddError(&errs, v.TtlAmt.Validate()) + rtp.AddError(&errs, baseName+".TtlAmt", v.TtlAmt.Validate()) } if v.Dtls != nil { for indx := range v.Dtls { - rtp.AddError(&errs, v.Dtls[indx].Validate()) + rtp.AddError(&errs, baseName+".Dtls", v.Dtls[indx].Validate()) } } if errs.Empty() { @@ -1083,10 +1148,11 @@ func (v TaxAmount2) Validate() error { func (v TaxAmountAndType1) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxAmountAndType1" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } - rtp.AddError(&errs, v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -1095,11 +1161,12 @@ func (v TaxAmountAndType1) Validate() error { func (v TaxAmountType1Choice) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxAmountType1Choice" if v.Cd != nil { - rtp.AddError(&errs, v.Cd.Validate()) + rtp.AddError(&errs, baseName+".Cd", v.Cd.Validate()) } if v.Prtry != nil { - rtp.AddError(&errs, v.Prtry.Validate()) + rtp.AddError(&errs, baseName+".Prtry", v.Prtry.Validate()) } if errs.Empty() { return nil @@ -1109,11 +1176,12 @@ func (v TaxAmountType1Choice) Validate() error { func (v TaxAuthorisation1) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxAuthorisation1" if v.Titl != nil { - rtp.AddError(&errs, v.Titl.Validate()) + rtp.AddError(&errs, baseName+".Titl", v.Titl.Validate()) } if v.Nm != nil { - rtp.AddError(&errs, v.Nm.Validate()) + rtp.AddError(&errs, baseName+".Nm", v.Nm.Validate()) } if errs.Empty() { return nil @@ -1123,39 +1191,40 @@ func (v TaxAuthorisation1) Validate() error { func (v TaxInformation7) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxInformation7" if v.Cdtr != nil { - rtp.AddError(&errs, v.Cdtr.Validate()) + rtp.AddError(&errs, baseName+".Cdtr", v.Cdtr.Validate()) } if v.Dbtr != nil { - rtp.AddError(&errs, v.Dbtr.Validate()) + rtp.AddError(&errs, baseName+".Dbtr", v.Dbtr.Validate()) } if v.UltmtDbtr != nil { - rtp.AddError(&errs, v.UltmtDbtr.Validate()) + rtp.AddError(&errs, baseName+".UltmtDbtr", v.UltmtDbtr.Validate()) } if v.AdmstnZone != nil { - rtp.AddError(&errs, v.AdmstnZone.Validate()) + rtp.AddError(&errs, baseName+".AdmstnZone", v.AdmstnZone.Validate()) } if v.RefNb != nil { - rtp.AddError(&errs, v.RefNb.Validate()) + rtp.AddError(&errs, baseName+".RefNb", v.RefNb.Validate()) } if v.Mtd != nil { - rtp.AddError(&errs, v.Mtd.Validate()) + rtp.AddError(&errs, baseName+".Mtd", v.Mtd.Validate()) } if v.TtlTaxblBaseAmt != nil { - rtp.AddError(&errs, v.TtlTaxblBaseAmt.Validate()) + rtp.AddError(&errs, baseName+".TtlTaxblBaseAmt", v.TtlTaxblBaseAmt.Validate()) } if v.TtlTaxAmt != nil { - rtp.AddError(&errs, v.TtlTaxAmt.Validate()) + rtp.AddError(&errs, baseName+".TtlTaxAmt", v.TtlTaxAmt.Validate()) } if v.Dt != nil { - rtp.AddError(&errs, v.Dt.Validate()) + rtp.AddError(&errs, baseName+".Dt", v.Dt.Validate()) } if v.SeqNb != nil { - rtp.AddError(&errs, v.SeqNb.Validate()) + rtp.AddError(&errs, baseName+".SeqNb", v.SeqNb.Validate()) } if v.Rcrd != nil { for indx := range v.Rcrd { - rtp.AddError(&errs, v.Rcrd[indx].Validate()) + rtp.AddError(&errs, baseName+".Rcrd", v.Rcrd[indx].Validate()) } } if errs.Empty() { @@ -1166,14 +1235,15 @@ func (v TaxInformation7) Validate() error { func (v TaxParty1) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxParty1" if v.TaxId != nil { - rtp.AddError(&errs, v.TaxId.Validate()) + rtp.AddError(&errs, baseName+".TaxId", v.TaxId.Validate()) } if v.RegnId != nil { - rtp.AddError(&errs, v.RegnId.Validate()) + rtp.AddError(&errs, baseName+".RegnId", v.RegnId.Validate()) } if v.TaxTp != nil { - rtp.AddError(&errs, v.TaxTp.Validate()) + rtp.AddError(&errs, baseName+".TaxTp", v.TaxTp.Validate()) } if errs.Empty() { return nil @@ -1183,17 +1253,18 @@ func (v TaxParty1) Validate() error { func (v TaxParty2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxParty2" if v.TaxId != nil { - rtp.AddError(&errs, v.TaxId.Validate()) + rtp.AddError(&errs, baseName+".TaxId", v.TaxId.Validate()) } if v.RegnId != nil { - rtp.AddError(&errs, v.RegnId.Validate()) + rtp.AddError(&errs, baseName+".RegnId", v.RegnId.Validate()) } if v.TaxTp != nil { - rtp.AddError(&errs, v.TaxTp.Validate()) + rtp.AddError(&errs, baseName+".TaxTp", v.TaxTp.Validate()) } if v.Authstn != nil { - rtp.AddError(&errs, v.Authstn.Validate()) + rtp.AddError(&errs, baseName+".Authstn", v.Authstn.Validate()) } if errs.Empty() { return nil @@ -1203,14 +1274,15 @@ func (v TaxParty2) Validate() error { func (v TaxPeriod2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxPeriod2" if v.Yr != nil { - rtp.AddError(&errs, v.Yr.Validate()) + rtp.AddError(&errs, baseName+".Yr", v.Yr.Validate()) } if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } if v.FrToDt != nil { - rtp.AddError(&errs, v.FrToDt.Validate()) + rtp.AddError(&errs, baseName+".FrToDt", v.FrToDt.Validate()) } if errs.Empty() { return nil @@ -1220,32 +1292,33 @@ func (v TaxPeriod2) Validate() error { func (v TaxRecord2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxRecord2" if v.Tp != nil { - rtp.AddError(&errs, v.Tp.Validate()) + rtp.AddError(&errs, baseName+".Tp", v.Tp.Validate()) } if v.Ctgy != nil { - rtp.AddError(&errs, v.Ctgy.Validate()) + rtp.AddError(&errs, baseName+".Ctgy", v.Ctgy.Validate()) } if v.CtgyDtls != nil { - rtp.AddError(&errs, v.CtgyDtls.Validate()) + rtp.AddError(&errs, baseName+".CtgyDtls", v.CtgyDtls.Validate()) } if v.DbtrSts != nil { - rtp.AddError(&errs, v.DbtrSts.Validate()) + rtp.AddError(&errs, baseName+".DbtrSts", v.DbtrSts.Validate()) } if v.CertId != nil { - rtp.AddError(&errs, v.CertId.Validate()) + rtp.AddError(&errs, baseName+".CertId", v.CertId.Validate()) } if v.FrmsCd != nil { - rtp.AddError(&errs, v.FrmsCd.Validate()) + rtp.AddError(&errs, baseName+".FrmsCd", v.FrmsCd.Validate()) } if v.Prd != nil { - rtp.AddError(&errs, v.Prd.Validate()) + rtp.AddError(&errs, baseName+".Prd", v.Prd.Validate()) } if v.TaxAmt != nil { - rtp.AddError(&errs, v.TaxAmt.Validate()) + rtp.AddError(&errs, baseName+".TaxAmt", v.TaxAmt.Validate()) } if v.AddtlInf != nil { - rtp.AddError(&errs, v.AddtlInf.Validate()) + rtp.AddError(&errs, baseName+".AddtlInf", v.AddtlInf.Validate()) } if errs.Empty() { return nil @@ -1255,10 +1328,11 @@ func (v TaxRecord2) Validate() error { func (v TaxRecordDetails2) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TaxRecordDetails2" if v.Prd != nil { - rtp.AddError(&errs, v.Prd.Validate()) + rtp.AddError(&errs, baseName+".Prd", v.Prd.Validate()) } - rtp.AddError(&errs, v.Amt.Validate()) + rtp.AddError(&errs, baseName+".Amt", v.Amt.Validate()) if errs.Empty() { return nil } @@ -1267,18 +1341,19 @@ func (v TaxRecordDetails2) Validate() error { func (v TransactionReferences5) Validate() error { var errs base.ErrorList = base.ErrorList{} + baseName := "TransactionReferences5" if v.PmtInfId != nil { - rtp.AddError(&errs, v.PmtInfId.Validate()) + rtp.AddError(&errs, baseName+".PmtInfId", v.PmtInfId.Validate()) } if v.InstrId != nil { - rtp.AddError(&errs, v.InstrId.Validate()) + rtp.AddError(&errs, baseName+".InstrId", v.InstrId.Validate()) } - rtp.AddError(&errs, v.EndToEndId.Validate()) + rtp.AddError(&errs, baseName+".EndToEndId", v.EndToEndId.Validate()) if v.TxId != nil { - rtp.AddError(&errs, v.TxId.Validate()) + rtp.AddError(&errs, baseName+".TxId", v.TxId.Validate()) } if v.UETR != nil { - rtp.AddError(&errs, v.UETR.Validate()) + rtp.AddError(&errs, baseName+".UETR", v.UETR.Validate()) } if errs.Empty() { return nil @@ -1289,306 +1364,296 @@ func (v TransactionReferences5) Validate() error { // XSD SimpleType validations func (v ActiveOrHistoricCurrencyCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{3,3}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "USD")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{3,3}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "USD"); err != nil { + return err + } + return nil } func (v AnyBICDec2014Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}`); err != nil { + return err } - return errs + return nil } func (v CountryCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z]{2,2}`)) - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW")) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z]{2,2}`); err != nil { + return err } - return errs + if err := rtp.ValidateEnumeration(string(v), "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"); err != nil { + return err + } + return nil } func (v CreditDebitCode) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CRDT", "DBIT")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CRDT", "DBIT"); err != nil { + return err } - return errs + return nil } func (v DocumentType3Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "DISP", "FXDR", "PUOR", "RADM", "RPIN", "SCOR")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "DISP", "FXDR", "PUOR", "RADM", "RPIN", "SCOR"); err != nil { + return err } - return errs + return nil } func (v DocumentType6Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "AROI", "BOLD", "CINV", "CMCN", "CNFA", "CREN", "DEBN", "DISP", "DNFA", "HIRI", "MSIN", "PUOR", "SBIN", "SOAC", "TSUT", "VCHR")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "AROI", "BOLD", "CINV", "CMCN", "CNFA", "CREN", "DEBN", "DISP", "DNFA", "HIRI", "MSIN", "PUOR", "SBIN", "SOAC", "TSUT", "VCHR"); err != nil { + return err } - return errs + return nil } func (v ExternalDiscountAmountType1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "APDS", "STDS", "TMDS")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "APDS", "STDS", "TMDS"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalDocumentLineType1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ADPI", "AISB", "ASNB", "CTNB", "DBSP", "EANN", "EINB", "GSNB", "HIBC", "ISBN", "LTNB", "MDNB", "PRNB", "PTCD", "SKNB", "STNB", "TONB", "UPCC", "UPNB")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ADPI", "AISB", "ASNB", "CTNB", "DBSP", "EANN", "EINB", "GSNB", "HIBC", "ISBN", "LTNB", "MDNB", "PRNB", "PTCD", "SKNB", "STNB", "TONB", "UPCC", "UPNB"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalGarnishmentType1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "GNCS", "GNDP", "GTPP")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "GNCS", "GNDP", "GTPP"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalOrganisationIdentification1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "BANK", "CBID", "CHID", "CINC", "COID", "CUST", "DUNS", "EMPL", "GS1G", "SREN", "SRET", "TXID")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "BANK", "CBID", "CHID", "CINC", "COID", "CUST", "DUNS", "EMPL", "GS1G", "SREN", "SRET", "TXID"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalPersonIdentification1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "ARNU", "CCPT", "CUST", "DRLC", "EMPL", "NIDN", "SOSE", "TXID")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "ARNU", "CCPT", "CUST", "DRLC", "EMPL", "NIDN", "SOSE", "TXID"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v ExternalTaxAmountType1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CITY", "CNTY", "LOCL", "PROV", "STAT")) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CITY", "CNTY", "LOCL", "PROV", "STAT"); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v LEIIdentifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[A-Z0-9]{18,18}[0-9]{2,2}`); err != nil { + return err } - return errs + return nil } func (v Max128Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 128)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 128); err != nil { + return err + } + return nil } func (v Max140Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 140)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 140); err != nil { + return err + } + return nil } func (v Max16Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 16)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 16); err != nil { + return err + } + return nil } func (v Max2048Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 2048)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 2048); err != nil { + return err + } + return nil } func (v Max34Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 34)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 34); err != nil { + return err + } + return nil } func (v Max35Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`)) - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 35)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*`); err != nil { + return err } - return errs + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err + } + if err := rtp.ValidateMaxLength(string(v), 35); err != nil { + return err + } + return nil } func (v Max35TextTCH2) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 9)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 9)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 9); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 9); err != nil { + return err + } + return nil } func (v Max4Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 4)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 4); err != nil { + return err + } + return nil } func (v Max70Text) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), 1)) - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), 70)) - if errs.Empty() { - return nil + if err := rtp.ValidateMinLength(string(v), 1); err != nil { + return err } - return errs + if err := rtp.ValidateMaxLength(string(v), 70); err != nil { + return err + } + return nil } func (v NamePrefix2Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "DOCT", "MADM", "MIKS", "MISS", "MIST")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "DOCT", "MADM", "MIKS", "MISS", "MIST"); err != nil { + return err } - return errs + return nil } func (v Number) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateFractionDigits(fmt.Sprintf("%v", v), 0)) - rtp.AddError(&errs, rtp.ValidateTotalDigits(fmt.Sprintf("%v", v), 18)) - if errs.Empty() { - return nil + if err := rtp.ValidateFractionDigits(fmt.Sprintf("%v", v), 0); err != nil { + return err } - return errs + if err := rtp.ValidateTotalDigits(fmt.Sprintf("%v", v), 18); err != nil { + return err + } + return nil } func (v PercentageRate) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateFractionDigits(fmt.Sprintf("%v", v), 10)) - rtp.AddError(&errs, rtp.ValidateTotalDigits(fmt.Sprintf("%v", v), 11)) - if errs.Empty() { - return nil + if err := rtp.ValidateFractionDigits(fmt.Sprintf("%v", v), 10); err != nil { + return err } - return errs + if err := rtp.ValidateTotalDigits(fmt.Sprintf("%v", v), 11); err != nil { + return err + } + return nil } func (v PhoneNumber) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `\+[0-9]{1,3}-[0-9()+\-]{1,30}`); err != nil { + return err } - return errs + return nil } func (v PreferredContactMethod1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "CELL", "FAXX", "LETT", "MAIL", "PHON")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "CELL", "FAXX", "LETT", "MAIL", "PHON"); err != nil { + return err } - return errs + return nil } func (v TaxRecordPeriod1Code) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), "HLF1", "HLF2", "MM01", "MM02", "MM03", "MM04", "MM05", "MM06", "MM07", "MM08", "MM09", "MM10", "MM11", "MM12", "QTR1", "QTR2", "QTR3", "QTR4")) - if errs.Empty() { - return nil + if err := rtp.ValidateEnumeration(string(v), "HLF1", "HLF2", "MM01", "MM02", "MM03", "MM04", "MM05", "MM06", "MM07", "MM08", "MM09", "MM10", "MM11", "MM12", "QTR1", "QTR2", "QTR3", "QTR4"); err != nil { + return err } - return errs + return nil } func (v TrueFalseIndicator) Validate() error { - var errs base.ErrorList = base.ErrorList{} - if errs.Empty() { - return nil - } - return errs + return nil } func (v UUIDv4Identifier) Validate() error { - var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`)) - if errs.Empty() { - return nil + if err := rtp.ValidatePattern(string(v), `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}`); err != nil { + return err } - return errs + return nil } diff --git a/go.sum b/go.sum index 2e762ad..5b42008 100644 --- a/go.sum +++ b/go.sum @@ -1,42 +1,20 @@ -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= -cloud.google.com/go v0.110.9 h1:e7ITSqGFFk4rbz/JFIqZh3G4VEHguhAL4BQcFlWtU68= -cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= -cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= -cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/moov-io/base v0.45.1 h1:1gZuINLBAw+HS78NLcKjSd8cH8fmA2qIHZwgYP+N/WU= -github.com/moov-io/base v0.45.1/go.mod h1:F2hLIojBgQJxRWTFLRTYuta/w+z2BBgDcd5k0BSifGA= -github.com/moov-io/base v0.46.0 h1:4sgFjfD9EELJ+i6cGfPtezoPAAxwE3imLJ64bbHtBwM= -github.com/moov-io/base v0.46.0/go.mod h1:AFoLPJA1uuylLp33g1nGzTnGk8zyqYH7KfBS7flc0P8= -github.com/moov-io/base v0.47.0 h1:r4PALYPSMwCB/smDUcMUk3a2JW6TA4mT17oOBx9ZpEE= -github.com/moov-io/base v0.47.0/go.mod h1:jz9m/WyTr6RTbm1DP0V5j4RVUuXqmq3bUnzJ6NwCPo8= -github.com/moov-io/base v0.47.1 h1:kQXBbTesyqb9ETem/jCeG2bYGuOpZYFbTHHVrwcpkrY= -github.com/moov-io/base v0.47.1/go.mod h1:AVMPYsHbPg+TxqOpfwIIHuT1rLsjxEhIekIKRj91i4I= -github.com/moov-io/base v0.48.1 h1:BVKjtEdR79ZjBeTF8Dl56ko43w3HaAnsUDhUoSVV9g4= -github.com/moov-io/base v0.48.1/go.mod h1:cFHUtEDjzxjc4SBjkntYNF4LB166iLN5eGR2BBSJenI= github.com/moov-io/base v0.48.2 h1:BPSNgmwokOVaVzAMJg71L48LCrDYelMfVXJEiZb2zOY= github.com/moov-io/base v0.48.2/go.mod h1:u1/WC3quR6otC9NrM1TtXSwNti1A/m7MR49RIXY1ee4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rickar/cal/v2 v2.1.13 h1:FENBPXxDPyL1OWGf9ZdpWGcEiGoSjt0UZED8VOxvK0c= diff --git a/internal/templates/rtp20022/validate.tgo b/internal/templates/rtp20022/validate.tgo index 1317b52..2930cc4 100644 --- a/internal/templates/rtp20022/validate.tgo +++ b/internal/templates/rtp20022/validate.tgo @@ -18,20 +18,23 @@ import ( {{ range .ExportableElements }} func (v {{ .GoName }}) Validate() error { var errs base.ErrorList = base.ErrorList{} + {{- if or (gt (len .Attributes) 0) (gt (len .Elements) 0) }} + baseName := "{{ .GoName }}" + {{- end }} {{- range .Attributes }} {{ if eq .Use "optional" }}if v.{{ .GoName }} != nil { {{ end }} - rtp.AddError(&errs, v.{{ .GoName }}.Validate()) + rtp.AddError(&errs, baseName+".{{ .GoName }}", v.{{ .GoName }}.Validate()) {{ if eq .Use "optional" }} } {{ end }} - {{- end }} + {{- end }} {{- range .Elements }} {{ if eq .MinOccurs "0" }}if v.{{ .GoName }} != nil { {{ end }} {{- if eq .GoTypeName "SignatureEnvelope" -}} {{- else if .Array -}} for indx := range v.{{ .GoFieldName }} { - rtp.AddError(&errs, v.{{ .GoFieldName }}[indx].Validate()) + rtp.AddError(&errs, baseName+".{{ .GoName }}", v.{{ .GoFieldName }}[indx].Validate()) } {{- else -}} - rtp.AddError(&errs, v.{{ .GoFieldName }}.Validate()) + rtp.AddError(&errs, baseName+".{{ .GoName }}", v.{{ .GoFieldName }}.Validate()) {{- end -}} {{ if eq .MinOccurs "0" }} } {{ end }} {{- end }} @@ -53,9 +56,12 @@ import ( {{ else }} func (v {{ .GoName }}) Validate() error { var errs base.ErrorList = base.ErrorList{} + {{- if or (gt (len .Attributes) 0) (gt (len .Elements) 0) }} + baseName := "{{ .GoName }}" + {{- end }} {{- range .Attributes }} {{ if eq .Use "optional" }}if v.{{ .GoName }} != nil { {{ end }} - rtp.AddError(&errs, v.{{ .GoName }}.Validate()) + rtp.AddError(&errs, baseName+".{{ .GoName }}", v.{{ .GoName }}.Validate()) {{ if eq .Use "optional" }} } {{ end }} {{- end }} {{- range .Elements }} @@ -63,10 +69,10 @@ import ( {{- if eq .GoTypeName "SignatureEnvelope" -}} {{- else if .Array -}} for indx := range v.{{ .GoFieldName }} { - rtp.AddError(&errs, v.{{ .GoFieldName }}[indx].Validate()) + rtp.AddError(&errs, baseName+".{{ .GoName }}", v.{{ .GoFieldName }}[indx].Validate()) } {{- else -}} - rtp.AddError(&errs, v.{{ .GoFieldName }}.Validate()) + rtp.AddError(&errs, baseName+".{{ .GoName }}", v.{{ .GoFieldName }}.Validate()) {{- end -}} {{ if eq .MinOccurs "0" }} } {{ end }} {{- end }} @@ -90,48 +96,62 @@ import ( {{ else if eq .GoName "Max20000Text" }} {{ else }} func (v {{ .GoName }}) Validate() error { - var errs base.ErrorList = base.ErrorList{} {{- if .Restriction.Pattern }} - rtp.AddError(&errs, rtp.ValidatePattern(string(v), `{{ .Restriction.Pattern.Value }}`)) + if err := rtp.ValidatePattern(string(v), `{{ .Restriction.Pattern.Value }}`); err != nil { + return err + } {{- end }} - {{- if .Restriction.Enums }} - rtp.AddError(&errs, rtp.ValidateEnumeration(string(v), {{ range .Restriction.Enums }}"{{ .Value }}", {{ end }})) + if err := rtp.ValidateEnumeration(string(v), {{ range .Restriction.Enums }}"{{ .Value }}", {{ end }}); err != nil { + return err + } {{- end }} - {{- if .Restriction.MinInclusive }} - rtp.AddError(&errs, rtp.ValidateMinInclusive({{ .GoTypeName }}(v), {{ .Restriction.MinInclusive.Value }})) + if err := rtp.ValidateMinInclusive({{ .GoTypeName }}(v), {{ .Restriction.MinInclusive.Value }}); err != nil { + return err + } {{- end }} {{- if .Restriction.MaxInclusive }} - rtp.AddError(&errs, rtp.ValidateMaxInclusive({{ .GoTypeName }}(v), {{ .Restriction.MaxInclusive.Value }})) + if err := rtp.ValidateMaxInclusive({{ .GoTypeName }}(v), {{ .Restriction.MaxInclusive.Value }}); err != nil { + return err + } {{- end }} {{- if .Restriction.MinExclusive }} - rtp.AddError(&errs, rtp.ValidateMinExclusive({{ .GoTypeName }}(v), {{ .Restriction.MinExclusive.Value }})) + if err := rtp.ValidateMinExclusive({{ .GoTypeName }}(v), {{ .Restriction.MinExclusive.Value }}); err != nil { + return err + } {{- end }} {{- if .Restriction.MaxExclusive }} - rtp.AddError(&errs, rtp.ValidateMaxExclusive({{ .GoTypeName }}(v), {{ .Restriction.MaxExclusive.Value }})) + if err := rtp.ValidateMaxExclusive({{ .GoTypeName }}(v), {{ .Restriction.MaxExclusive.Value }}); err != nil { + return err + } {{- end }} - {{- if .Restriction.FractionDigits }} - rtp.AddError(&errs, rtp.ValidateFractionDigits(fmt.Sprintf("%v", v), {{ .Restriction.FractionDigits.Value }})) + if err := rtp.ValidateFractionDigits(fmt.Sprintf("%v", v), {{ .Restriction.FractionDigits.Value }}); err != nil { + return err + } {{- end }} {{- if .Restriction.TotalDigits }} - rtp.AddError(&errs, rtp.ValidateTotalDigits(fmt.Sprintf("%v", v), {{ .Restriction.TotalDigits.Value }})) + if err := rtp.ValidateTotalDigits(fmt.Sprintf("%v", v), {{ .Restriction.TotalDigits.Value }}); err != nil { + return err + } {{- end }} - {{- if .Restriction.Length }} - rtp.AddError(&errs, rtp.ValidateLength(string(v), {{ .Restriction.MinLength.Value }})) + if err := rtp.ValidateLength(string(v), {{ .Restriction.MinLength.Value }}); err != nil { + return err + } {{- end }} {{- if .Restriction.MinLength }} - rtp.AddError(&errs, rtp.ValidateMinLength(string(v), {{ .Restriction.MinLength.Value }})) + if err := rtp.ValidateMinLength(string(v), {{ .Restriction.MinLength.Value }}); err != nil { + return err + } {{- end }} {{- if .Restriction.MaxLength }} - rtp.AddError(&errs, rtp.ValidateMaxLength(string(v), {{ .Restriction.MaxLength.Value }})) + if err := rtp.ValidateMaxLength(string(v), {{ .Restriction.MaxLength.Value }}); err != nil { + return err + } {{- end }} - if errs.Empty() { - return nil - } - return errs + return nil } {{ end }} {{ end }} diff --git a/pkg/rtp/restrictions.go b/pkg/rtp/restrictions.go index 4d7eafa..a5cabd5 100644 --- a/pkg/rtp/restrictions.go +++ b/pkg/rtp/restrictions.go @@ -10,14 +10,14 @@ import ( "github.com/moov-io/base" ) -func AddError(errs *base.ErrorList, err error) { +func AddError(errs *base.ErrorList, fieldName string, err error) { if err != nil { if el, ok := err.(base.ErrorList); ok { for indx := range el { errs.Add(el[indx]) } } else { - errs.Add(err) + errs.Add(fmt.Errorf("%v: %v", fieldName, err)) } } } diff --git a/pkg/rtp/restrictions_test.go b/pkg/rtp/restrictions_test.go index 0e087ee..cdd3b50 100644 --- a/pkg/rtp/restrictions_test.go +++ b/pkg/rtp/restrictions_test.go @@ -14,8 +14,9 @@ import ( func TestValidateMultipleErrors(t *testing.T) { var errs base.ErrorList = base.ErrorList{} - rtp.AddError(&errs, pacs_008_001_08.Max35TextTCH("B20230931145322200000057A11712044729M").Validate()) - require.Len(t, errs, 2) + rtp.AddError(&errs, "Max35TextTCH", pacs_008_001_08.Max35TextTCH("B20230931145322200000057A11712044729M").Validate()) + require.Len(t, errs, 1) + require.ErrorContains(t, errs.Err(), "Max35TextTCH: B20230931145322200000057A11712044729M fails validation with pattern M[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))[A-Z0-9]{11}.*") } func TestValidatePattern(t *testing.T) { diff --git a/tests/pacs_008_test.go b/tests/pacs_008_test.go new file mode 100644 index 0000000..7fb4287 --- /dev/null +++ b/tests/pacs_008_test.go @@ -0,0 +1,36 @@ +package tests + +import ( + "encoding/xml" + "strings" + "testing" + + "github.com/moov-io/base" + "github.com/moov-io/rtp20022/gen/messages" + + "github.com/stretchr/testify/require" +) + +func TestPacs008(t *testing.T) { + input := `000000010B1200000058T1B20231206000000010B1B00335081122910pacs.008.001.082023-12-06T23:08:38FZ5WNW1KttP2ZoEkvu5YliFKRxzuwxAPSTeAafm4HCA=kqN8hzwC0KmMKVVXbwOWWxdLBhn3gb0jA0a9wpQz85CcgPE0hR1zA5A7gv4WWvFooqnMLotzLQ/tzaGKjbbPm1Bf08XLc+BcWVzXjCfRSMNtpR+gMp50ODGlvNafrMHnsummGkFWF3+HGivCFpkLWSzau2+20DKsCxAQGGdhWCMfDqcYWfRVrkVWKVfz+YDUF7K7U7hXVM3DuWhJMcxmcIwGern/14KX+fIecMxsE2+a8R+sOPr5gYQ+TOwwFo/bwGCHTT5MLSgOpa+1+fLYnxY0QVYXihIGMYuy+JyW3JS+1FkzRU4X3oWayfe8FEVnkTTHZ0kTx/pFuOdLY5pZvg==CN=DigiCert Global G2 TLS RSA SHA256 2020 CA1,O=DigiCert Inc,C=US7733185569732290893228546868636904811CN=bc553361-9e6a-468f-9941-e7acb234513d.moov.io,O=Moov Financial Inc.,L=Cedar Falls,ST=Iowa,C=USM20231206000000010B1B003350811229102023-12-06T23:08:381526.332023-12-06CLRGTCH20231206200000057T1B123840081122910NOREF20231206200000057T1B123840081122910SDVAINTERMEDIARYCONSUMER526.33SLEV123456780987654320Moov, Inc65434577456456123456780987654320Jane Doe842 Other Ave89415Green StreamIAUS74625332505100907` + + t.Run("parse and validate, while expecting errors", func(t *testing.T) { + var m messages.Message + err := xml.NewDecoder(strings.NewReader(input)).Decode(&m) + require.NoError(t, err) + + err = m.Validate() + require.Error(t, err) + + el, ok := err.(base.ErrorList) + require.True(t, ok) + require.Len(t, el, 5) + + // Check each error + require.ErrorContains(t, el[0], "PostalAddress24TCH.StrtNm: fails validation with length 0 >= required minLength 1") + require.ErrorContains(t, el[1], "PostalAddress24TCH.PstCd: fails validation with length 0 >= required minLength 1") + require.ErrorContains(t, el[2], "PostalAddress24TCH.TwnNm: fails validation with length 0 >= required minLength 1") + require.ErrorContains(t, el[3], "PostalAddress24TCH.CtrySubDvsn: fails validation with length 0 >= required minLength 1") + require.ErrorContains(t, el[4], "PostalAddress24TCH.Ctry: fails validation with pattern [A-Z]{2,2}") + }) +}