<commit_before>import Joi from 'api/lib/joi.coffee'
const { API_MAX, API_PAGE_SIZE } = process.env

const unitSchema = Joi.object().keys({
  assets: Joi.array().items(
    Joi.object().keys({
      name: Joi.string().allow(''),
      slug: Joi.string()
    })
  ),
  body: Joi.string(),
  disclaimer: Joi.string(),
  headline: Joi.string(),
  layout: Joi.string(),
  link: Joi.object().keys({
    text: Joi.string(),
    url: Joi.string()
  }),
  logo: Joi.string(),
  name: Joi.string()
})

const schema = Joi.object().keys({
  canvas: unitSchema,
  end_date: Joi.date(),
  panel: unitSchema,
  name: Joi.string(),
  sov: Joi.number(),
  start_date: Joi.date()
})

const querySchema = {
  layout: Joi.string(),
  limit: Joi.number().max(Number(API_MAX)).default(Number(API_PAGE_SIZE)),
  name: Joi.string(),
  q: Joi.string().allow('')
}

export default { schema, querySchema }
<commit_msg>Adds isTypeOf to Display schema<commit_after>import Joi from 'api/lib/joi.coffee'
const { API_MAX, API_PAGE_SIZE } = process.env

const unitSchema = Joi.object().meta({
  name: 'DisplayUnit',
  isTypeOf: (data) => {}
}).keys({
  assets: Joi.array().items(
    Joi.object().keys({
      url: Joi.string()
    })
  ),
  body: Joi.string(),
  disclaimer: Joi.string(),
  headline: Joi.string(),
  layout: Joi.string(),
  link: Joi.object().keys({
    text: Joi.string(),
    url: Joi.string()
  }),
  logo: Joi.string(),
  name: Joi.string()
})

const schema = Joi.object().keys({
  canvas: unitSchema,
  end_date: Joi.date(),
  panel: unitSchema,
  name: Joi.string(),
  sov: Joi.number(),
  start_date: Joi.date()
})

const querySchema = {
  layout: Joi.string(),
  limit: Joi.number().max(Number(API_MAX)).default(Number(API_PAGE_SIZE)),
  name: Joi.string(),
  q: Joi.string().allow('')
}

export default { schema, querySchema }

{'fraction_non_alphanumeric': 0.19220208676551345, 'fraction_numerical': 0.0, 'mean_word_length': 3.7571801566579635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6869212', 'n_tokens_mistral': 690, 'n_tokens_neox': 689, 'n_words': 137}