We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const Ajv = require('ajv'); const ajv = new Ajv({ allErrors: true, format: 'full', useDefaults: true, coerceTypes: false, errorDataPath: 'property', sourceCode: false, }); require('ajv-merge-patch')(ajv); const base = { type: 'object', properties: { operation: { type: 'string', enum: ['create', 'update', 'delete'], }, id: { type: 'string', }, }, }; const schema = { $merge: { source: base, with: { type: 'object', properties: { test: { type: 'integer', default: 0, }, }, } } }; const params = { operation: 'delete' }; const validate = ajv.compile(schema); const isValidParams = validate(params); console.log(params);
Actual : { operation: 'delete' } Expected : { operation: 'delete' , test: 0}
The text was updated successfully, but these errors were encountered:
@epoberezkin are there any workarounds for it? So far even defining default in "with" is simply ignored.
Sorry, something went wrong.
No branches or pull requests
Actual :
{ operation: 'delete' }
Expected :
{ operation: 'delete' , test: 0}
The text was updated successfully, but these errors were encountered: