Skip to content

User Friendly Key Names #414

@agraddy

Description

@agraddy

Is there a way to output "Password Confirmation must match password" when a schema like this is used (from customMessage.js language example):

password_confirmation: Joi.any().valid(Joi.ref('password')).required().options({ language: { any: { allowOnly: 'must match password' } } })

That customMessage.js example currently outputs:

 password_confirmation must match password

I would like to be able to do something like this (added a "label()" call to the end):

password_confirmation: Joi.any().valid(Joi.ref('password')).required().options({ language: { any: { allowOnly: 'must match password' } } }).label('Password Confirmation')

Where the label replaces the key so that it outputs:

Password Confirmation must match password

Is this already possible and I'm misunderstanding something?

This issue has been brought up once before here: #190

That issue was closed when the language addition was added, but unless I'm misunderstanding something, the language update didn't address the original issue so I'm opening a new issue (I don't have a lot of experience with Github issues so if there is a better way of reopening an issue, let me know).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew functionality or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions