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

Wrapper syntax #11

Open
vhoyer opened this issue Oct 22, 2019 · 0 comments
Open

Wrapper syntax #11

vhoyer opened this issue Oct 22, 2019 · 0 comments

Comments

@vhoyer
Copy link
Owner

vhoyer commented Oct 22, 2019

what if we use this syntax instead:

export default {
  props: {
    myProp: validationHelper({
      type: String,
      required: true,
      options: ['these', 'properties'],
      errorMessage: 'This is a custom message, your value was wrong, try one of this: {_options_}',
  }),
}
export default {
  props: {
    myProp: validationHelper((t) => ({
      type: String,
      required: true,
      shape: t.type({
        userId: t.number,
        name: t.string,
      }),
      errorMessage: ({ options, shape, value, required, type }) => {
        return 'This is a custom message, your value was wrong, try one of this: {_options_}'
      },
  })),
}
export default {
  props: {
    myProp: validationHelper((t) => ({
      type: String,
      required: true,
      shape: t.array(t.type({
        userId: t.number,
        name: t.string,
      })),
      errorMessage: 'This is a custom message, your value was wrong, expected: {_shape_}, received: {_value_}',
  })),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant