-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add Evaluator#schema_error?
and Evaluator#rule_error?
#617
Conversation
Evaluator#error?
Evaluator#error?
416587c
to
c53b41f
Compare
Ah, yes it is intended. I forgot this method is used for checking schema errors :( Not sure what to do with this. Maybe leave it as-is for now and introduce |
@solnic then |
I think that current name is misleading... what do you think about adding for now |
In order to keep a thin interface another option is to overload |
@waiting-for-dev I was going to suggest |
I'm for it |
Hmm not sure I'm following here... Currently, |
Yes, and
My understanding is that we want to check if a rule failed, doesn't matter under which key, because a rule can fail due to multiple reasons. @flash-gordon have you considered that ☝️ ? |
I don't think having |
c53b41f
to
3d2052a
Compare
Hey @solnic @flash-gordon you can check it now |
Evaluator#error?
Evaluator#schema_error?
and Evaluator#rule_error?
2b34b7c
to
afe9e40
Compare
docsite/source/rules.html.md
Outdated
``` | ||
|
||
In complex rules you may be interested to know whether the current rule already | ||
had an error. For that, you can use `#rule_error?` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use hard-wrapping in docs, it can actually screw up MD formatting AND it makes writing docs really annoying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies... I fixed it 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, approved but with a minor doc-related comment 😄
Thank you @waiting-for-dev! |
This tries to implement what has been discussed in #615
@flash-gordon @solnic please, take a look at the WIP code... the spec is failing because
#error?(:email)
returns false, even when it has an error added in the first rule. It's becauseEvaluator#error?
delegates toResult#error?
, which in turn delegates toDry::Schema::Result#error?
. Is it intended behaviour? I mean, we are looking just to the errors set in the schema phase and ignoring rules.