Add context for array operation#2317
Merged
sdirix merged 1 commit intoeclipsesource:masterfrom Apr 11, 2024
Merged
Conversation
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
sdirix
requested changes
Apr 9, 2024
Member
sdirix
left a comment
There was a problem hiding this comment.
Looks good and thanks for adding the tests. Please have a look at my comments.
sdirix
reviewed
Apr 9, 2024
packages/core/src/actions/actions.ts
Outdated
Comment on lines
+80
to
+81
| const firstValueType = typeof context.values[0]; | ||
| return context.values.every((v) => typeof v === firstValueType); |
Member
There was a problem hiding this comment.
I think this check is not necessary. JSON Schema supports different types in arrays.
Member
Author
There was a problem hiding this comment.
but we don't support this in jsonforms, so all newly added values must be of the same type
I'm fine removing this check
Member
There was a problem hiding this comment.
We don't support it in JSON Forms in our current renderers but there is no restriction for that in JSON Schema and custom/future renderers might support that.
sdirix
reviewed
Apr 9, 2024
Currently it is very hard to figure out in the middleware what array operation happend to lead to the current array state. There are cases were this information is valuable. To support this all update actions can now have a 'context'. Here we added a specific 'UpdateArrayContext'. Contributed on behalf of STMicroelectronics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently it is very hard to figure out in the middleware what array operation happend to lead to the current array state. There are cases were this information is valuable. To support this all update actions can now have a 'context'. Here we added a specific 'UpdateArrayContext'.
Contributed on behalf of STMicroelectronics