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

When using reach, changing the label doesn't get applied, when an existing label is there #900

Closed
kevbook opened this issue May 24, 2016 · 1 comment
Assignees
Labels
bug Bug or defect
Milestone

Comments

@kevbook
Copy link

kevbook commented May 24, 2016

Context

  • node version: v4.4.3
  • joi version: ^9.0.0-0
  • environment (node, browser): node
  • used with (hapi, standalone, ...): standalone
  • any other relevant information:

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

Describe your issue here, include schemas and inputs you are validating if needed.
When using reach, the new label is ignored.

const Joi = require('joi');
const schema = Joi.object({ foo: Joi.number().label('foo_1') });
const reachSchema = Joi.object({ 
   a: Joi.reach(schema, 'foo').label('foo_2')
});

console.log(reachSchema.validate({ a: 'blah' }).error);

Which result you had ?

Error: child "a" fails because ["foo_1" must be a number]
message: "\"foo_1\" must be a number"
path: "a"
type: "number.base"
name: "ValidationError"

What did you expect ?

message: "\"foo_2\" must be a number"
@kevbook kevbook changed the title When using reach, applying a changing the label doesn't get applied, when an existing label is there When using reach, changing the label doesn't get applied, when an existing label is there May 24, 2016
@Marsup Marsup added the bug Bug or defect label May 24, 2016
@Marsup Marsup self-assigned this May 24, 2016
@Marsup Marsup modified the milestones: 9.0.0, 8.1.1 May 24, 2016
@Marsup Marsup closed this as completed in 7f91f29 May 24, 2016
@Marsup
Copy link
Collaborator

Marsup commented May 24, 2016

Thanks for the report, fixed and published. How are you finding v9 so far ?

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 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