Remove validate.schema as a trap door

This commit is contained in:
ekzyis 2024-07-17 03:32:00 +02:00
parent 6a5713034b
commit 5d03e08514
2 changed files with 19 additions and 23 deletions

View File

@ -19,9 +19,6 @@ export function generateSchema (wallet) {
return validator
}
// complex validation
if (field.validate.schema) return field.validate.schema
const { type: validationType, words, min, max } = field.validate
let validator

View File

@ -10,9 +10,8 @@ export const fields = [
label: 'connection',
type: 'password',
validate: {
schema: string()
.required('required')
.test(async (nwcUrl, context) => {
type: 'string',
test: async (nwcUrl, context) => {
// run validation in sequence to control order of errors
// inspired by https://github.com/jquense/yup/issues/851#issuecomment-1049705180
try {
@ -32,7 +31,7 @@ export const fields = [
return context.createError({ message: err.message })
}
return true
})
}
}
}
]