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

怎么样设置contract让字段为空时不检验,不为空时检验正则呢 #82

Open
Hydrostic opened this issue Mar 30, 2020 · 0 comments

Comments

@Hydrostic
Copy link

Hydrostic commented Mar 30, 2020

xxxResource: {
    project_id: { type: 'integer',  pattern: '^[0-9]*[1-9][0-9]*$', description: '新建作品留空' },
  },

我一开始是这样写的,但是即使required不等于true它也会去校验正则,
后来我又 把正则改成了 ^$|^[0-9]*[1-9][0-9]*$ ,但是发现校验依然失败,
是不是不能这样设置呢?

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