fix(schema-form): fix oneof titles [KFE-2686] #595
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces improvements to the schema normalization logic for forms in the
react-ui-componentspackage, specifically focusing on howoneOfenums with titles are handled. The changes separate enum titles into theuiSchema(usingui:enumNames), simplify the schema structure, and update the component logic to merge normalized and user-provideduiSchema. Additionally, the pull request adds testing support with Vitest.Schema normalization and form rendering improvements:
normalizeEnumsandnormalizeSchemautilities inschema-form.tsto convertoneOfconstructs with{ title, const }into a flatenumarray in the schema, storing the titles in the correspondinguiSchemaasui:enumNames. This reduces schema nesting and improves compatibility with form libraries.KvSchemaForminSchemaForm.tsxto use the newnormalizeSchemareturn structure, merging the normalizeduiSchemawith any user-provideduiSchemato ensure both system and custom UI options are respected. [1] [2]x-titles) from the SelectWidget utilities, since enum titles are now handled viaui:enumNamesinuiSchema. [1] [2]Dependency and tooling updates:
vitestas a dev dependency in the rootpackage.jsonand introduced atestscript inreact-ui-components/package.jsonto enable and standardize testing. [1] [2]Other code quality improvements:
mergeimport fromlodashto support merging ofuiSchemaobjects inSchemaForm.tsx.