Skip to content

非同期バリデート時のValidationResult.isValidが結果がまだ出ていない時にnullではなくtrueになっている #503

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

Closed
fukudayasuo opened this issue Dec 24, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@fukudayasuo
Copy link

結果待ち中の場合はisValidはnullにする

fukudayasuo pushed a commit that referenced this issue Dec 24, 2015
isAllValidが結果がまだ出ていないならnull、今までの結果でvalidでないならfalse、という扱いでした。
この挙動になるように、isValidにnullを持たせるようにした部分は元に戻して、isAllValidについてのコードを修正しました。
@fukudayasuo
Copy link
Author

元々、isValidは現在validな状態かどうか(結果待ちがあるならtrue、結果が待ちが無いなら今までのvalid結果)を表すフラグでした。

isAllValidが結果がまだ出ていないならnull、今までの結果でvalidでないならfalse、という扱いでした。

この挙動になるように、isValidにnullを持たせるようにした部分は元に戻しました。

また、isAllValidの判定や判定タイミングに問題があったため、コードを修正しました。

@simdy simdy added this to the v1.2.1 milestone Jan 6, 2016
@simdy simdy added the wontfix label Jan 6, 2016
@simdy
Copy link
Member

simdy commented Jan 6, 2016

isValidは「現在までのバリデーション結果」を表し、isAllValidは「(非同期を含む)すべてのバリデーション結果」を表します。

非同期バリデーションを含まない場合はisValidとisAllValidは同じ値になります。
非同期バリデーションを含む場合、
同期的なチェックですでにエラーがある場合はisValid==isAllValid==falseとなり、
エラーがない場合は、
非同期チェックの結果でfalseなものがまだない⇒isValid==true, isAllValid==null
falseなものが一つでも帰ってきたら⇒isValid==isAllValid==false
となります。

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

No branches or pull requests

2 participants