Warn from SchemaField, for every type, when an enum hides anyOf/oneOf titles or ui:enumNames is ignored beside constant options

Author: heath-freenomeCreated Sep 30, 2026Updated Oct 1, 2026
LabelsuiSchemacoreneeds triagefeatureany-one-all-of

Prerequisites

What theme are you using?

core

Is your feature request related to a problem? Please describe.

Follow-up from #5364 (#5319), raised in review (r4131579117).

#5364 added two development warnings (logOnce(), naming the field), but only BooleanField logs them. Every other type drops the same configuration silently:

  1. An enum beside a non-constant anyOf/oneOf hides the option titles. SchemaField's isConstantSelect() treats the enum as a select, so the anyOf/oneOf titles never render. The options are read from the enum, not the anyOf/oneOf.

    json
    { "type": "string", "enum": ["a", "b"], "oneOf": [{ "title": "A" }, { "title": "B" }] }

    This renders ['', 'a', 'b'] with no warning. The boolean spelling warns.

  2. ui:enumNames/ui:enumOrder beside constant anyOf/oneOf options are ignored. optionsList() applies them only to enum values.

    json
    { "type": "string", "oneOf": [{ "const": "a" }, { "const": "b" }] }

    With { "ui:enumNames": ["A", "B"] }, this renders a/b with no warning. The boolean spelling warns.

Describe the solution you'd like

Move both checks from BooleanField into SchemaField, which already decides whether a schema is a select (getSelectSchemaInfo()/isConstantSelect()) and already logs uiSchema misconfiguration through logOnce() and fieldLabelForLog(). Then every type warns the same way, and BooleanField stops carrying its own copy.

The boolean conditions to carry over:

  • Hidden titles: some option has a title or a ui:title in uiSchema.anyOf/uiSchema.oneOf (hasOptionLabels(), already shared by both files), and some enum value isn't named by ui:enumNames.
  • Ignored ui:enumNames/ui:enumOrder: a non-empty ui:enumNames, or a ui:enumOrder that would reorder or drop one of the constant options, beside constant options.
  • When to skip: any widget other than the registered SelectWidget/RadioWidget, such as a checkbox, a hidden field or a custom widget like daisyui's toggle, which may show no option labels. A boolean checkbox that SchemaField only defaulted to still warns about ignored names when there are several options, since the names were meant to label a select.

Read the inference decision, don't re-derive it

BooleanField currently decides that a checkbox is one SchemaField defaulted to by checking !widget && altSchemas.length > 1 after the fact, which duplicates inferSelectWidget()'s criteria and can drift from them (raised in review, r4149888053). Moving the check next to inferSelectWidget() should use its actual decision instead.

A case that shows the drift, to cover with a test: SchemaField skips widget inference when a ui:field other than fields.BooleanField is set. So a custom field that wraps BooleanField:

javascript
const MyBool = (props) => <BooleanField {...props} />;

with { "ui:field": "MyBool", "ui:enumNames": ["Accept", "Decline"] } on

json
{ "type": "boolean", "oneOf": [{ "const": true, "title": "Yes please" }, { "const": false, "title": "No thanks" }] }

gets no inferred widget, renders a checkbox, and logs "Label those options with a title or a ui:title", even though the options are already titled.

Describe alternatives you've considered

  • Warn from optionsList(). It can't name the field or see the widget, and it's also called outside rendering (for example by getDefaultFormState()).
  • Leave the warnings boolean-only, as #5364 does. The same mistake then behaves differently depending on the field's type.

Generated with Claude Code

Source: rjsf-team/react-jsonschema-form