Replies: 3 comments 1 reply
-
Hi @dls314 👋 Great question! I am not currently on my computer, but wanted to at least reply; let me know if you'd like more detail and I can write out some examples when I'm back at my desk. Validation is applied to the attribute or nested attribute of the value being set. For example, if you set a map attribute with nested attributes, validation will be ran on those nested attributes first, and then lastly the map attribute. Alternatively, if you set a nested attribute directly, it will only validations for that attribute and not its map. The reasoning for this is because the values not being set are not known. In the second example above (where a nested attribute is set) ElectroDB only has the value of the nested attribute provided. If the containing map had a validation checking for values not being set, that function would likely throw because they would appear missing. Hope this helps, but let me know 👍 |
Beta Was this translation helpful? Give feedback.
-
Thanks! That was exactly what I needed |
Beta Was this translation helpful? Give feedback.
-
Hi @tywalch, I have a related question in this area about how a When From that return, This matches up with what I'm seeing in my usage, where my validate function is being called for a non-required undefined property while trying to create an item. It seems wrong that validation is being called for a non-required, undefined property. Did I miss something while reading through this? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a couple of questions about validation.
Also, a question about how validation runs for a Schema's MapAttribute when that MapAttribute has its own top level validate function as well as validate functions at its properties.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions