Skip to content
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

object.with and object.without throw error on $ prefixed keys #2226

Closed
augnin opened this issue Nov 21, 2019 · 0 comments
Closed

object.with and object.without throw error on $ prefixed keys #2226

augnin opened this issue Nov 21, 2019 · 0 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@augnin
Copy link

augnin commented Nov 21, 2019

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise):
    Community

  • is this issue currently blocking your project? (yes/no):
    No

  • is this issue affecting a production system? (yes/no):
    No

Context

  • node version: v12
  • module version with issue: 16.1.7
  • last module version without issue: v15
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

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

Confidence takes a json object with special purpose $-prefixed keys as input, using joi to validate it. I'm moving confidence store schema to joi v16 from v15. New implementation of methods such as object.with and object.without don't support $-prefixed keys or peers.

const schema = Joi.object().keys({
    $b: Joi.string(),
    $c: Joi.string()
}).without('$c', '$b');

What was the result you got?

Schema throws an error

Error: Non-value references cannot reference ancestors

What result did you expect?

handle $-prefixed keys

@augnin augnin added the support Questions, discussions, and general support label Nov 21, 2019
@hueniverse hueniverse self-assigned this Nov 22, 2019
@hueniverse hueniverse reopened this Nov 22, 2019
@hueniverse hueniverse added bug Bug or defect and removed support Questions, discussions, and general support labels Nov 22, 2019
@hueniverse hueniverse added this to the 16.1.8 milestone Nov 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 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