Skip to content

Commit

Permalink
Extend validation with rememberSchemes (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtich committed Jan 26, 2022
1 parent 56d1774 commit 3442c47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions services/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ module.exports = class ValidateService {
// additional parameters (optional)
type = (guessObjectType(type, true) || "").toLowerCase()

let schemes
const rememberSchemes = []
if (knownSchemes) {
// Get schemes from schemeService
schemes = await schemeService.getSchemes({})
knownSchemes = await schemeService.getSchemes({})
}
const validator = type ? validate[type] : validate

const result = data.map(item => {
const result = validator(item, { unknownFields, schemes })
const result = validator(item, { unknownFields, knownSchemes, rememberSchemes })
return result ? true : validator.errors
})

Expand Down

0 comments on commit 3442c47

Please sign in to comment.