You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the defaults are embedded in the code. This is in addition to them being listed in the master schema. This can lead to inconsistencies if the defaults are changed in one place but not the other. It can also be the cause of bugs. It would be nice to have one place for storing all the defaults, or at least a way to ensure that all the defaults match.
One idea is to have JsonSchema populate objects' defaults from the schema. This is something it doesn't do by default, but is capable of doing with minor hacking. See their documentation. They say, … none of the other validators modify the instance either. … It’s perfectly valid (and perhaps even useful) to have a default that is not valid under the schema it lives in! So an instance modified by the default would pass validation the first time, but fail the second! Still, this would be more elegant than the current solution.
Another solution may be to write a test that reads both sets of defaults and compares them. It would fail if anything is changed in only one place. However, it would require maintenance if ever we add any more defaults.
Currently, the defaults are embedded in the code. This is in addition to them being listed in the master schema. This can lead to inconsistencies if the defaults are changed in one place but not the other. It can also be the cause of bugs. It would be nice to have one place for storing all the defaults, or at least a way to ensure that all the defaults match.
One idea is to have JsonSchema populate objects' defaults from the schema. This is something it doesn't do by default, but is capable of doing with minor hacking. See their documentation. They say, … none of the other validators modify the instance either. … It’s perfectly valid (and perhaps even useful) to have a default that is not valid under the schema it lives in! So an instance modified by the default would pass validation the first time, but fail the second! Still, this would be more elegant than the current solution.
Another solution may be to write a test that reads both sets of defaults and compares them. It would fail if anything is changed in only one place. However, it would require maintenance if ever we add any more defaults.
Aha! Link: https://csiro.aha.io/features/ANONLINK-45
The text was updated successfully, but these errors were encountered: