I am trying to get the default value of pathFilter via convict.default()
Below is my configSchema
masks: {
format: 'Object',
body: {
doc: 'masks for body',
format: 'Array',
default: [],
children: {
pathFilter: {
format: RegExp,
doc: 'Filter for applying mask to certain paths',
default: /.*/,
},
},
},
},
And the config looks like:
masks: {
body: [
{
pathFilter: /xyz/,
},
],
}
I tried doing config.default('masks.body.children.pathFilter') but that doesn't work.
One problem that I see here is that we add and look for _cvtProperties under arrays too. Arrays seem to have children and not _cvtProperties. So the default function would resolve the path and look for body._cvtProperties but it won't exist.
Maybe we need to cater for arrays here
Please advise.