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

Consistently apply wrap setting #2330

Closed
individual11 opened this issue Mar 29, 2020 · 0 comments
Closed

Consistently apply wrap setting #2330

individual11 opened this issue Mar 29, 2020 · 0 comments
Assignees
Labels
bug Bug or defect feature New functionality or improvement
Milestone

Comments

@individual11
Copy link

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: 12.16.0
  • module version with issue: 17.1.1
  • last module version without issue: n/a
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information: n/a

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

Using the errors.wrap property introduced in 17 I'm getting rid of the quotes, and it's working on everything I've seen so far, except when using the with rule. It puts the quotes back in. In the below code, if you change a value to 1, then it will throw the correct error formatting around the label of a, but if a is the correct format (i.e. string), then the with error will throw, showing the quote marks.

const test = Joi.object({
   a: Joi.string(),
}).with('a', 'b');

const { error } = test.validate({ a: 'test' }, { errors: { wrap: { label: '*' } } });
console.log(error.details[0].message);
// "a" missing required peer "b"

What was the result you got?

"a" missing required peer "b"

What result did you expect?

*a* missing required peer *b*

@individual11 individual11 added the support Questions, discussions, and general support label Mar 29, 2020
@hueniverse hueniverse self-assigned this Jul 6, 2020
@hueniverse hueniverse added bug Bug or defect feature New functionality or improvement and removed support Questions, discussions, and general support labels Jul 6, 2020
@hueniverse hueniverse added this to the 17.2.0 milestone Jul 6, 2020
@hueniverse hueniverse changed the title wrap setting not working with "with" Consistently apply wrap setting Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

2 participants