Skip to content

Commit cf42181

Browse files
committed
chore: use existing Batcher interface
1 parent 271c3d8 commit cf42181

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

file_flattener.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,15 @@ func (m mergeableBatcher) AddToFile(file *File) error {
211211
})
212212

213213
// Inherit validation options from file if batch doesn't have them
214-
if file.GetValidation() != nil {
215-
// Use a local interface to access SetValidation
216-
type validatable interface {
217-
SetValidation(*ValidateOpts)
218-
}
214+
if opts := file.GetValidation(); opts != nil {
215+
m.batcher.SetValidation(opts)
219216

220-
if v, ok := m.batcher.(validatable); ok {
221-
v.SetValidation(file.GetValidation())
222-
223-
// Also set validation on all entries
224-
for _, entry := range m.batcher.GetEntries() {
225-
entry.SetValidation(file.GetValidation())
226-
}
227-
for _, entry := range m.batcher.GetADVEntries() {
228-
entry.SetValidation(file.GetValidation())
229-
}
217+
// Also set validation on all entries
218+
for _, entry := range m.batcher.GetEntries() {
219+
entry.SetValidation(opts)
220+
}
221+
for _, entry := range m.batcher.GetADVEntries() {
222+
entry.SetValidation(opts)
230223
}
231224
}
232225

0 commit comments

Comments
 (0)