-
Notifications
You must be signed in to change notification settings - Fork 407
Union UISchemaElement type #2436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
According to the README
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Condition
andUISchemaElement
types 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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
UISchemaElement
toBaseUISchemaElement
Added new
UISchemaElement
which is a union of all uischema options, includingBaseUISchemaElement
for backwards-compatibilitySame treatment for conditions
Condition
toBaseCondition
Condition
as new union typeUnrelated to the main changes, I found that
.nvmrc
had 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: