joi

    1熱度

    1回答

    我正在使用hapijs編寫微服務。我有一個請求體中有三個參數的API(POST方法) 用戶名 姓 出生 我打算用JOI做驗證的日期。驗證應該是以下 如果兩個姓氏和出生日期是 在請求 兩個姓氏和出生日期不存在,如果用戶名是應要求應要求用戶ID缺席 我試圖通過以下來實現。它似乎沒有工作。 export const userRequestModel = Joi.object().keys({

    3熱度

    1回答

    我有一個羽毛球API與messages service。我想用feathers-hooks-validate-joi模塊驗證消息模型。 這裏是我的messages-hooks.js文件: const validate = require('feathers-hooks-validate-joi'); const schema = require('./messages.validator');

    0熱度

    1回答

    所以我映射數據庫域響應領域,所以我不暴露數據層使用的SequelizeJS車型如field財產消費者: module.exports = function (sequelize, DataTypes) { return sequelize.define('Product', { id: { type: DataTypes.INTEGER,

    1熱度

    1回答

    如何使用joi驗證此對象?我用Hapi api使用Joi。 { "email":"[email protected]", "password":"abc123", "active":"", "details": { "firstName": "Rambo", "lastName": "Comando", "phoneNum

    1熱度

    1回答

    父PARAMS我如何能實現的東西像下面的邏輯查詢參數驗證: if (type is 'image') { subtype is Joi.string().valid('png', 'jpg') else if (type is 'publication') { subtype is Joi.string().valid('newspaper', 'book') 得到任何

    1熱度

    1回答

    我想驗證我返回的數據是否合理。驗證數據類型已完成。現在我想驗證我收到了執行任務所需的所有數據。 這裏有一個代表性的例子: { "things": [ { "id": "00fb60c7-520e-4228-96c7-13a1f7a82749", "name": "Thing 1", "url": "https://lolagons.com"

    1熱度

    1回答

    即使tel設置爲可選,但Joi返回以下錯誤。我們如何解決這個問題? 謝謝。 Error: Joi Failed: ValidationError: child "tel" fails because ["tel" is not allowed to be empty] //Define Joi schema const schema = { email: Joi.string().re

    0熱度

    1回答

    我正在嘗試使用Joi進行驗證,並且我想自定義錯誤消息。 這裏是我的驗證代碼: count: Joi.number().error(() => 'error message').min(1).required() 當我測試驗證,它示出了「‘計數’必須大於或等於1」和「錯誤消息」從未顯示。 我已經將abortEarly選項設置爲false,但沒有任何更改。 那麼在Joi打印錯誤信息的優先級是什麼?

    1熱度

    1回答

    在驗證使用我的模式我得到一個錯誤joi 所以我寫了這一點: const joiSchema = Joi.object().options({ abortEarly: false }).keys({ stream_name: Joi.string().required(), audio_bitrate: Joi.number().integer().min(80).require

    0熱度

    1回答

    我想寫以下對象(關聯數組)驗證方法: { "10:00": { discount: 10, time: "10:00", }, "11:00": { discount: 11, time: "11:00", }, ... .... } 使用淳佳(https://github.com/hapij