-
Notifications
You must be signed in to change notification settings - Fork 140
Open
Description
Hello,
i'm using the array validator in my schema.
Unfortunately, because it use a new convict instance to validate the schema, the default values of the elements in my array are not set.
I tried to get my active instance, but because I don't know where i am in the schema during the validation, I can't set the values on my own.
If someone as any idea ?
this is the validator:
convict.addFormat({
name: 'source-array',
validate: function(sources, schema) {
/* ... */
for (source of sources) {
convict(schema.children).load(source).validate();
}
}
});my schema:
defaultValue:
format: String
default: 'default'
contexts:
format: array
default: []
children:
defaultValue:
format: String
default: 'default'
name:
format: String
default: nullmy config file:
contexts:
- name: TEST1what I want:
{
"defaultValue": "default",
"contexts":[
{
"defaultValue": "default",
"name": "TEST1"
}
]
}what I have:
{
"defaultValue": "default",
"contexts":[
{
"name": "TEST1"
}
]
}vitalii-moholivskyi
Metadata
Metadata
Assignees
Labels
No labels