-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
Extensible validation support in Volto forms #6181
Conversation
* main: Remove `react-share` library and `SocialSharing` component (#6162)
Co-authored-by: David Glick <[email protected]>
✅ Deploy Preview for plone-components canceled.
|
@davisagli @stevepiercy I think I went through all the suggestions, let me know if I left something! |
Just to continue on my though on on-offs from the previous PR: I could implement a generic validator called |
@tiberiuichim yeah, I think you could do that already with the current implementation. However, that would only work with not serializable blocks defined in code. |
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.
Looks pretty good. I am uncertain about one of my suggestions for the code sample.
Co-authored-by: Steve Piercy <[email protected]>
@tiberiuichim I implemented your |
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.
@sneridagh my only concern left is regarding the type validator as we've spoken if field shouldn't also be suffixed with ? to mark it as optional as both isNumber and startEventDateRangeValidator makes no direct use of the field
https://github.com/plone/volto/pull/6181/files#diff-0fb5051092a06c331a0607394901c0217dc85e7d2f3ce393fadab348e0832b56R298
@ichim-david done. |
Co-authored-by: Victor Fernandez de Alba <[email protected]>
Merging! Thanks to all for the effort and for having this done! |
Supersedes #6161
Refactored and re-document for clarity and simplicity from it.
@stevepiercy I think now it's the good one. I'm more satisfied with this one now. I will review myself again, but I think it's ready for check.
@davisagli I've refactored it a bit after talking to @robgietema in lieu of clarity and simplicity. Also reflected it in the docs too. Decisions I made, we can talk about it:
Create an API for
registerUtility
I think this is much more cleaner and fixes the thing you've mentioned in the other PR, for the "trying to push the square shaped piece in the circle shape hole". Also, I took it from a previous conversation last week with @ericof but that's another story. TL;DR: it was about the convenience of having an API that does and registers things for you, whatever it is, if it's a widget or a view, or other thing where you should "touch" and manually set things in different places. This makes much more sense to me now, with the current shape.
It will also make sense in other scenarios where I think we will need such "named utilities", eg. in other frameworks, having utility helpers, like flattenToAppUrl, globally, then ask for them in a named way.
Using the
format
property from JSON schema specs@robgietema pointed me out to this one, I'm using the default property for defining named validators as defined in the spec.
I still have to cleanup, will continue working polishing this a bit.
📚 Documentation preview 📚: https://volto--6181.org.readthedocs.build/