-
Notifications
You must be signed in to change notification settings - Fork 48
adding ValidateOpts #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
adding ValidateOpts #295
Changes from 5 commits
74c4927
1aa2813
64bf1e1
7964276
7c2ee0c
d15b6ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,15 @@ var ( | |
| msgFileCredit = "Credit outside of cash letter" | ||
| ) | ||
|
|
||
| // ValidateOpts contains specific overrides from the default set of validations | ||
| type ValidateOpts struct { | ||
| // SkipAll will disable all validation checks of a File. It has no effect when set on records. | ||
| SkipAll bool `json:"skipAll"` | ||
|
Comment on lines
+96
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exact validation function of record will hit within reader function only |
||
|
|
||
| // AllowInvalidArchiveTypeIndicator can be set to disable archiveTypeIndicator validation | ||
| AllowInvalidArchiveTypeIndicator bool `json:"allowInvalidArchiveType"` | ||
| } | ||
|
|
||
| // FileError is an error describing issues validating a file | ||
| type FileError struct { | ||
| FieldName string | ||
|
|
@@ -119,6 +128,8 @@ type File struct { | |
| Bundles []Bundle `json:"bundle,omitempty"` | ||
| // FileControl is an imagecashletter FileControl | ||
| Control FileControl `json:"fileControl"` | ||
|
|
||
| validateOpts *ValidateOpts | ||
| } | ||
|
|
||
| // NewFile constructs a file template with a FileHeader and FileControl. | ||
|
|
@@ -322,3 +333,20 @@ func (f *File) setRecordTypes() { | |
| } | ||
| f.Control.setRecordType() | ||
| } | ||
|
|
||
| // SetValidation stores ValidateOpts | ||
| func (f *File) SetValidation(opts *ValidateOpts) { | ||
| if f == nil || opts == nil { | ||
| return | ||
| } | ||
|
|
||
| f.validateOpts = opts | ||
| } | ||
|
|
||
| // ValidateOpts returns Validation option | ||
| func (f *File) ValidateOpts() *ValidateOpts { | ||
| if f.validateOpts == nil { | ||
| return &ValidateOpts{} | ||
| } | ||
| return f.validateOpts | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.