-
Notifications
You must be signed in to change notification settings - Fork 95
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
Preserve typing information during expression compilation #6925
Merged
Elmacioro
merged 3 commits into
staging
from
preserve-typing-information-when-invalid-during-custom-validation
Sep 26, 2024
Merged
Preserve typing information during expression compilation #6925
Elmacioro
merged 3 commits into
staging
from
preserve-typing-information-when-invalid-during-custom-validation
Sep 26, 2024
Conversation
This file contains 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
created: #6933 |
4fad9ca
to
a0d2e86
Compare
a0d2e86
to
03d4a47
Compare
8d012c9
to
b72a900
Compare
b72a900
to
39fe35d
Compare
arkadius
approved these changes
Sep 26, 2024
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.
Good job, one small comment added. Merge it after fix it
designer/server/src/test/scala/pl/touk/nussknacker/ui/integration/DictsFlowTest.scala
Outdated
Show resolved
Hide resolved
de319eb
to
0b99d56
Compare
Elmacioro
added a commit
that referenced
this pull request
Sep 27, 2024
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.
Describe your changes
Currently, there is a problem with nodes that utilize presets as sometimes labels are not present and are presented as
null
.This happens when we want to use a component or fragment with presets, select some values for them and save the scenario.
If there were any errors during compilation of that node presets will have null labels.
This happens because
ProcessDictSubstituor
dynamically adds and removes presets' labels.To add labels at that level we need parameters' types which are assigned during compilation. Unfortunately when there is any custom validators error during node compilation we lose typing information.
in
ExperssionCompiler.compileNodeParameters()
allCompiledParams contain the typing info and is of
ValidatedNel
type. WhenValidations.validateWithCustomValidators(allParams, paramValidatorsMap)
isInvalid
we get these errors without previous typing.To solve this issue I introduced a change which will still pass typing info further even when there are some custom validator errors. Instead of using
Validated
which can represent two states:Valid
andInvalid
, I usedIor
which lets us have 3 states:Left
,Right
andBoth
. First two are self-explanatory andBoth
can hold both failure and a success. This way we can preserve the typing info while also preserving errors from custom validation. After testing these changes locally, we preserve the typing info and have correct preset labels even when there were errors during compilation.Checklist before merge