@lableb/javascript-sdk
Version:
Lableb cloud search client for javascript
30 lines (22 loc) • 983 B
text/typescript
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 { BatchSearchFeedbackRequestParams } from './search-feedback.request.type';
// @ts-ignore
export const buildBatchSearchFeedbackRequestSchema: yup.SchemaOf<BatchSearchFeedbackRequestParams> =
baseRequestSchema.concat(
yup.object()
.shape({
searchHandler: 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
),
})
);