0

I have the following schema:

    schema: {
      type: 'array',
      items: {
        type: 'object',
        properties: {
          type: {
            enum: ['string', 'number', 'boolean']
          },
          value: {
            type: ??,
          }
        }
      }

    }

How can I set the type of value based on the enum of the type property? For example:

{
  "type": "string",
  "value": 1 // this shouldn't be valid
}

{
  "type": "number",
  "value": 1 // this is fine
}
undefined
  • 6,366
  • 12
  • 46
  • 90

0 Answers0