<commit_before>import * as yup from 'yup'

export const basic = yup.object().shape({
  name: yup.string().required().default(''),
  role: yup.number().required().default(1),
  secondaryReporter: yup.boolean(),
  iatiActivityID: yup.string(),
  fundingAmount: yup.mixed()
})

const array = yup.array().of(basic).min(1, 'At least one partner is required for your validation set')
const arrays = {
  basic: array,
  IATI: array,
  DGIS: array
}

export const getValidationSets = (validationSets, opts = {}) => {
  return [opts.arrays ? arrays.basic : basic]
}

export default arrays
<commit_msg>[#3545] partners validation fix<commit_after>import * as yup from 'yup'

export const basic = yup.object().shape({
  name: yup.string().required().default(''),
  role: yup.number().required().default(1),
  secondaryReporter: yup.boolean(),
  iatiActivityID: yup.string(),
  fundingAmount: yup.mixed().when('role', {
    is: 1,
    then: yup.mixed().required()
  })
})

const array = yup.array().of(basic).min(1, 'At least one partner is required for your validation set')
const arrays = {
  basic: array,
  IATI: array,
  DGIS: array
}

export const getValidationSets = (validationSets, opts = {}) => {
  return [opts.arrays ? arrays.basic : basic]
}

export default arrays

{'fraction_non_alphanumeric': 0.15955766192733017, 'fraction_numerical': 0.0071090047393364926, 'mean_word_length': 4.437768240343348, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '252243', 'n_tokens_mistral': 425, 'n_tokens_neox': 417, 'n_words': 111}