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

custom label for each properties #36

Open
gk-devteam opened this issue Jan 22, 2020 · 1 comment
Open

custom label for each properties #36

gk-devteam opened this issue Jan 22, 2020 · 1 comment

Comments

@gk-devteam
Copy link

gk-devteam commented Jan 22, 2020

Hello and thanks a lot for this very helpful plugin!

I was wondering if there was a way to customize the way the error message is sent by using a label instead of the property name.

For example, by using this kind of syntax:

schema: {
    query: {
      type: 'object',
      required: ['score'],
      properties: {
        score: {
          type: 'integer',
          label: 'スコア',
          errorMessage: {
            type: '${/score}が数字ではない'
          }
        }
    }
  }

I would get the following
スコア "true"が数字ではない
instead of
query/score "true"が数字ではない

I am sorry if it is already written somewhere. I have read so many articles today that my head might explodes by the end of the day.

@gk-devteam
Copy link
Author

@epoberezkin
If using a label field to substitute the property's name is not really possible, how about just sending the error message without the property's name before?
I am trying to look into the errorMessage.jst file, but to be honest I never used Dot template before and I can't really find a way to remove the property's name. (Is it coming from $dataPath?)
If you don't have the time to add this option into the package, can you please give me a hint about where I could update the code to handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

0 participants