I want to check one field and allow other fields without checking; for example, to check: field "firstname". In my code, when I comment on the "payload", hapi allows me to write any field, when I uncomment the "payload" hapijs, I donβt allow me to write any field, but I just want to check the "firstname" example as a "string" and let the rest of the field allow. I plan that the variable fields correspond to the database configuration, so I'm going to just check out some fixed fields and allow other variable fields to be saved that are managed in the interface and not in the backend
config: { validate: { } }
UPDATED: thanks to Robert C. Bell, I adapted the solution to add 'validate':
config: { validate: { options: { allowUnknown: true }, payload: { firstname: Joi.string() } } }
source share