Skip to content

Conversation

@ricardogoncalves89
Copy link
Collaborator

@ricardogoncalves89 ricardogoncalves89 commented Nov 21, 2025

This pull request introduces improvements to the schema normalization logic for forms in the react-ui-components package, specifically focusing on how oneOf enums with titles are handled. The changes separate enum titles into the uiSchema (using ui:enumNames), simplify the schema structure, and update the component logic to merge normalized and user-provided uiSchema. Additionally, the pull request adds testing support with Vitest.

Schema normalization and form rendering improvements:

  • Refactored the normalizeEnums and normalizeSchema utilities in schema-form.ts to convert oneOf constructs with { title, const } into a flat enum array in the schema, storing the titles in the corresponding uiSchema as ui:enumNames. This reduces schema nesting and improves compatibility with form libraries.
  • Updated KvSchemaForm in SchemaForm.tsx to use the new normalizeSchema return structure, merging the normalized uiSchema with any user-provided uiSchema to ensure both system and custom UI options are respected. [1] [2]
  • Removed the legacy logic for handling custom enum titles (x-titles) from the SelectWidget utilities, since enum titles are now handled via ui:enumNames in uiSchema. [1] [2]

Dependency and tooling updates:

  • Added vitest as a dev dependency in the root package.json and introduced a test script in react-ui-components/package.json to enable and standardize testing. [1] [2]

Other code quality improvements:

  • Added missing merge import from lodash to support merging of uiSchema objects in SchemaForm.tsx.

@ricardogoncalves89 ricardogoncalves89 requested a review from a team as a code owner November 21, 2025 18:22
@djcouto djcouto merged commit 18f9a00 into dev Jan 8, 2026
1 check passed
@djcouto djcouto deleted the schema-enums branch January 8, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants