Fix Rich text block validation path #18578
Merged
+15
−2
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.
Description
The base implementation of the block validator does not take into account that the actual implementation can wrap its content/settings data in another object.
This causes issues with the jsonpath returned in validation messages not matching with the actual property path.
To fix this, the hardcoded mapping was moved into a get only overridable string.
The RTE block validator can now signal the correct path to the base class with an override.
Testing
Ask Niels 😅
Or setup a doctype with a blocklist/grid and an RTE using the same element doctype that has properties with validation that fails on the backend. Create the node add a block to each property => Save and publish => the validate endpoint should return a jsonpath for the invalid properties in the RTE block that starts with
$...value.blocks.contentData...
instead of$...value.contentData...