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 schema = Joi.object().keys({ 'mail.from': Joi.string().lowercase().email().optional(), 'mail.url': Joi.string().uri({ scheme: ['https'] }).optional(), }).xor( 'mail.from', 'mail.url', ); Joi.validate({ 'mail.url': 'https://example.com' }, schema));
Removing .xor() seems to fix the validation.
.xor()
{ error: { ValidationError: "value" must contain at least one of [mail.from, mail.url] at Object.exports.process (node_modules/joi/lib/errors.js:201:19) at internals.Object._validateWithOptions (node_modules/joi/lib/types/any/index.js:722:31) at module.exports.internals.Any.root.validate node_modules/joi/lib/index.js:146:23) at Object.<anonymous> (joi.js:13:17) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10) isJoi: true, name: 'ValidationError', details: [ [Object] ], _object: { 'mail.url': 'https://example.com' }, annotate: [Function] }, value: { 'mail.url': 'https://example.com' }, then: [Function: then], catch: [Function: catch] }
{ error: null, value: { 'mail.url': 'https://example.com' }, then: [Function: then], catch: [Function: catch] }
The text was updated successfully, but these errors were encountered:
The problem is that many methods support key reaching (e.g. a.b is translated into ['a']['b']).
a.b
['a']['b']
Sorry, something went wrong.
c64b41f
hueniverse
No branches or pull requests
Context
What are you trying to achieve or the steps to reproduce ?
Removing
.xor()
seems to fix the validation.Which result you had ?
What did you expect ?
The text was updated successfully, but these errors were encountered: