Clean up validation/defaults handling
InfusOnWoW opened this issue ยท 1 comments
We have in WeakAuras a per regionType table of "defaults", which we really use for two purposes.
a) Actually as defaults for new regions
b) As a type check for validation
This has lead to problems multiple times, so we should fix that by:
a) Either having a more explicit struture, e.g.
local defaults = {
icon = {
type = "bool",
default = true
},
[....]
subRegions = {
type = "subRegion", -- ??? Special logic for handling subRegions in validation?
default = {
[1] = "subbackground",
[2] = "subforeground"
}
}
}
b) Or two separate structures
In the same are there's trap. We do validation before we do modernization. The reason for that it was that way forever. I think that's done to make Modernize safer, since it can work on validated data. But this order has also lead to problems multiple times. So we should do imho two things:
a) Move validation to be after Modernization
b) Wrap Modernize in a pcall so that if it fails for an aura, we can print a error and continue.
I did implement the validation after modernization change. But didn't make the more drastic change with the default table.
I still think there's a need for metadata data for the auradata data. That is, e.g. a more fine grained update display/decision, copy/paste, this default data and probably more that I'm forgetting. But that's for another time.