Trying to use the component in an electron app, with specifying the JSON schema.
What I expect is that I can create the store with a potentially invalid underlying config, but when I call store.get(key)
an exception should be thrown that the config is not valid.
What happens currently is that an exception is thrown from the constructor, as it seems there's no way to disable validation when the object is created: https://github.com/sindresorhus/conf/blob/main/source/index.ts#L133 . Currently, this makes it impossible to gracefully fix the config, the only option is to nuke the whole thing with . <- just tested this, doesn't work πclearInvalidConfig
which will make users really mad that they lose their whole config
Example:
config.json
contents:
{ "myKey": "myValue" }
Code:
store = new ElectronStore({
schema: {
myKey: {
type: 'boolean',
},
},
})
This throws an exception right away Error: Config schema violation: 'myKey' must be boolean
.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too