UNPKG

@lableb/javascript-sdk

Version:

Lableb cloud search client for javascript

30 lines (22 loc) 1.02 kB
import * as yup from 'yup'; import { MESSAGES } from '../../config/messages'; import { recommendFeedbackDocumentSchema } from '../feedback/feedback.document.schema'; import { baseRequestSchema } from '../main/main.request.schema'; import { BatchRecommendFeedbackRequestParams } from './recommend-feedback.request.type'; // @ts-ignore export const buildBatchRecommendFeedbackRequestSchema: yup.SchemaOf<BatchRecommendFeedbackRequestParams> = baseRequestSchema.concat( yup.object() .shape({ recommendHandler: yup.string().optional(), APIKey: yup .string() .required(MESSAGES.API_KEY_IS_REQUIRED), documentsFeedbacks: yup.array() .required(MESSAGES.FEEDBACK_DOCUMENTS_ARE_REQUIRED) .min(1, MESSAGES.FEEDBACK_DOCUMENTS_LENGTH_INVALID) .of( recommendFeedbackDocumentSchema ), }) );