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
And I have a schema coming from a different location
constschema={title: 'Files',type: 'object',properties: {name: {type: string,description: 'A name',title: 'Name','other-name': 'name-string'},details: {type: string,description: 'A description of details',title: 'Details','other-name': 'details-string'},},required: ['name','details'],};
Now my object will be invalid because details is required but doesn't exist. However, it does exist in dataDefaults. Is there a way that if during validation I don't find a value for a given property (example above details) that it looks for that property in dataDefaults instead? The schema comes with a custom keyword other-name defining what that property would be called within the dataDefaults object.
If I can modify the schema to add a default param on each property containing an other-name keyword and set that default value to the other name value at compile of the schema then this is solved.
I would expect my final object after validation to look like:
{name: 'foo',details: 'baz',}
The text was updated successfully, but these errors were encountered:
Hi :)
I have been given an object that I want to validate as well as an object with defaults for those values if they don't exist.
And I have a schema coming from a different location
Now my object will be invalid because
details
is required but doesn't exist. However, it does exist indataDefaults
. Is there a way that if during validation I don't find a value for a given property (example abovedetails
) that it looks for that property indataDefaults
instead? The schema comes with a custom keywordother-name
defining what that property would be called within thedataDefaults
object.If I can modify the schema to add a
default
param on each property containing another-name
keyword and set that default value to the other name value at compile of the schema then this is solved.I would expect my final object after validation to look like:
The text was updated successfully, but these errors were encountered: