Skip to main content
Version: Current (v7.0.0-beta.3)

A switch between options keeps a scalar the new option holds

Detect​

  • In your schema: a string, number or boolean field with anyOf or oneOf options that each describe the value, such as options that differ in minLength, maximum or default.
  • In your tests: a switch between such options that expects the value cleared or replaced with the new option's default.

Change​

A switch between options keeps a string, number or boolean the new option holds, as it keeps an array (#5944). With s: { type: 'string', anyOf: [{ title: 'Short', maxLength: 10 }, { title: 'Long', minLength: 2, default: 'long' }] } and the data { s: 'abcd' }, select Long. Before: { s: 'long' }. After: { s: 'abcd' }.

  • A value the new option's type can't hold, or its const or enum leaves out, is dropped.
  • A value that is still the old option's default, const or only enum value takes the new option's default or const. Where that option declares neither, the value stays if the option's enum or constant options list it, and is dropped otherwise.
  • A readOnly option with a default or const takes it, as before.

Update the tests and stored values that expect the value cleared or replaced with the new option's default.

Verify​

  • After a switch, the field holds the value the user typed where the new option accepts it, and the new option's default where the value was the old option's.

Also read: