Union UISchemaElement type #2436
Conversation
According to the README
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
lucas-koehler
left a comment
There was a problem hiding this comment.
Hi @IceFreez3r , thanks for the contribution ❤️
The changes already look quite good to me. I have only two small asks:
- Please add a comment to the new
ConditionandUISchemaElementtypes as they are public API - Please add a new section for the 3.6 (which is the next one) release and explain the type changes to the migration guide.
|
@lucas-koehler Added the requested changes. Is the migration section like you had in mind? |
lucas-koehler
left a comment
There was a problem hiding this comment.
@IceFreez3r LGTM now! Thanks for the updates :)
| * This includes all layout elements, control elements, label elements, | ||
| * group elements, category elements and categorization elements. | ||
| */ | ||
| export type UISchemaElement = |
There was a problem hiding this comment.
Ah, this is nice to see! I created this same thing in jsonforms-antd-renderers, but with a type argument for the literal type of the corresponding jsonschema. Having the schema as a type argument allows us to intersect UISchemaElement with SchemaAwareScope, which traverses the jsonschema (via the type system, not at runtime), to give us autocomplete and type-checking when defining UISchemas, ie for valid scope values, or options configurations.
Changes
as discussed in #2109
Renamed
UISchemaElementtoBaseUISchemaElementAdded new
UISchemaElementwhich is a union of all uischema options, includingBaseUISchemaElementfor backwards-compatibilitySame treatment for conditions
ConditiontoBaseConditionConditionas new union typeUnrelated to the main changes, I found that
.nvmrchad a different node version than required in the README, so I updated it to node 22Compliance
Build and lint both run through. I have one failing test:
test/testers.test.ts, but I checked and it also fails without my changes, so I assume it's unrelated. Error message for reference: