UNPKG

@lableb/javascript-sdk

Version:

Lableb cloud search client for javascript

30 lines (22 loc) 1.01 kB
import * as yup from 'yup'; import { MESSAGES } from '../../config/messages'; import { feedbackDocumentSchema } from '../feedback/feedback.document.schema'; import { baseRequestSchema } from '../main/main.request.schema'; import { BatchAutocompleteFeedbackRequestParams } from './autocomplete-feedback.request.type'; // @ts-ignore export const buildBatchAutocompleteFeedbackRequestSchema: yup.SchemaOf<BatchAutocompleteFeedbackRequestParams> = baseRequestSchema.concat( yup.object() .shape({ autocompleteHandler: 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( feedbackDocumentSchema ), }) );