'use strict'; const makeSchema = require('../utils/makeSchema'); const { INCOMPATIBLE_FIELD_SCHEMA_KEYS } = require('../constants'); // the following takes an array of string arrays (string[][]) and returns the follwing string: // * `a` & `b` // * `c` & `d` // ... etc const wrapInBackticks = (s) => `\`${s}\``; const formatBullet = (f) => `* ${f.map(wrapInBackticks).join(' & ')}`; const incompatibleFieldsList = INCOMPATIBLE_FIELD_SCHEMA_KEYS.map(formatBullet).join('\n'); module.exports = makeSchema({ id: '/PlainFieldSchema', description: `In addition to the requirements below, the following keys are mutually exclusive:\n\n${incompatibleFieldsList}`, type: 'object', required: ['key'], docAnnotation: { hide: true }, properties: { key: { description: 'A unique machine readable key for this value (IE: "fname").', type: 'string', minLength: 1, }, label: { description: 'A human readable label for this value (IE: "First Name").', type: 'string', minLength: 1, }, type: { description: 'The type of this value. Use `string` for basic text input, `text` for a large, `