Function Validate

  • Main validator method, returns a Promise that throws an error when something is invalid according to schema set up, or true when all validations are fine.

    Parameters

    • model: any

      the object that represents the model, with key and values to be validated e.g. { name: 'Emmanuel' }

    • fieldNames: string[]

      list of fields to be validated

    • schema: Schema

      The Mongoose like schema containing all validations

    Returns Promise<unknown>

    Throws

    FormooseError

Generated using TypeDoc