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
Some config fields have validation rules which we check on startup. For example, that a list of endpoints must be non-empty. However, when we later try to fetch that retrieve that list from the config we don't have any way to guarantee that the list is in fact non-empty.
This leads to either re-validating the list or trusting that validation did in-fact take place (and possibly panicking if the assumption is wrong).
Instead, we can have a ValidatedConfig type that is returned by the validation logic guaranteeing that validation took place. e.g Input config has the format
structConfig{endpoints:Vec<EndPoint>,// Serialized from disk, may or may not be empty.}
while the returned, validated config has the same format but with a new type
structValidatedConfig{endpoints:Endpoints,// Endpoints is a type that guarantees that the internal list is non-empty.}
The text was updated successfully, but these errors were encountered:
A ValidatedConfig type is returned after validating a
config, so that any code that relies on config invariants do
not need to re-validate the config.
Fixes#172
A ValidatedConfig type is returned after validating a
config, so that any code that relies on config invariants do
not need to re-validate the config.
Fixes#172
Co-authored-by: Mark Mandel <[email protected]>
Some config fields have validation rules which we check on startup. For example, that a list of endpoints must be non-empty. However, when we later try to fetch that retrieve that list from the config we don't have any way to guarantee that the list is in fact non-empty.
This leads to either re-validating the list or trusting that validation did in-fact take place (and possibly panicking if the assumption is wrong).
Instead, we can have a
ValidatedConfig
type that is returned by the validation logic guaranteeing that validation took place. e.g Input config has the formatwhile the returned, validated config has the same format but with a new type
The text was updated successfully, but these errors were encountered: