Skip to content

path-related methods (with(), nand()...) broken when applied on func()` #1665

New issue

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

Closed
feugy opened this issue Nov 25, 2018 · 1 comment
Closed
Labels
bug Bug or defect
Milestone

Comments

@feugy
Copy link

feugy commented Nov 25, 2018

Context

  • node version: 8~10
  • joi version: 14.2.0
  • environment: node
  • used with: standalone
  • any other relevant information: worked with joi@13.0.0, seems to have been introduced with 14.0.0, and still failing with 14.2.0

What are you trying to achieve or the steps to reproduce ?

I'm validating extra keys attached to functions (which I reckon, is quite weird from the start 😅).

const joi = require('joi')
const schema = joi.func().keys({
  a: joi.string(),
  b: joi.string()
}).with('a', 'b')

const fct = () => {}
fct.a = 'hello'
// fct.b = 'world!'

joi.assert(fct, schema, 'Error prefix')

Which result you had ?

AssertionError: Invalid segment b in reach path b

see it live

What did you expect ?

Error: Error prefix "a" missing required peer "b"

see it live

@Marsup Marsup added the bug Bug or defect label Nov 25, 2018
@Marsup Marsup self-assigned this Nov 25, 2018
@Marsup Marsup added this to the 14.3.0 milestone Nov 25, 2018
@Marsup Marsup closed this as completed in 13ee9f7 Nov 25, 2018
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants