Open mwcraig opened 3 months ago
I agree that would be a nice feature -
It would be great if you have a go, and if you have questions or discover any other issues let me know -
the validation code is in here (AutoObject
and AutoArray
inherit this, I think EditGrid will too when I get round to refactoring):
https://github.com/maxfordham/ipyautoui/blob/main/src/ipyautoui/watch_validate.py
and every row is a AutoBox
:
https://github.com/maxfordham/ipyautoui/blob/main/src/ipyautoui/autobox.py
so this might be a good place for a validation indicator
Is your feature request related to a problem? Please describe.
Some of my pydantic models have several fields and some of those fields are a little complicated. For example, a field might allow several ways to initialize, and the pydantic validation error that is generated has several lines for each field.
Describe the solution you'd like
In addition to the green check or red x indicating whether the model as a whole is valid, a red check next to invalid fields would be really nice. It would be even nicer if clicking that red x displayed the validation errors for just that field.
There is still a need for a valid/invalid marker for the overall model in the event that there are checks that depend on more than one field.
Describe alternatives you've considered
I thought about having each field have its own green check or red x but am not sure the green checks are needed once the field is valid.
Additional context
I'm happy to try working on this here, or to work up a mockup in the package I'm using ipyautoui in or in a toy example.