-
Notifications
You must be signed in to change notification settings - Fork 176
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
Cost validator throws duplicate error for an invalid input #935
Comments
@jayeshv Thanks for reporting this. The reason there are two errors here is because there are two validators tat query fails against:
I'm thinking that proper fix here is to only run custom validators like price check only after standard validation has passed and we know there's nothing specially funky with the query. |
I too think that is the right fix. I made a rough fix here without knowing the entire code flow. I like this behavior, but I think what you are suggesting is to remove catching that exception. |
I'll experiment with this next week to see how we can handle this issue better. I'm not feeling comfortable about eating errors that may be caused by potentially serious issues elsewhere in validator. |
Apologies for the delay, but I've finally investigated this. My initial idea was to do two separate validity checks, one for spec compliance checks (those test if graphql query is valid), and other for custom validators (but only if spec checks passed), but this means running AST visitor twice, and thats going to be costful for larger queries. I am considering three approaches:
I like option 1 the most and 2 the least. I'll see how much work it would be to implement 3. |
Alternative solutions:
|
Punting this from 0.17, I don't feel this is big issue that should prevent the release. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Unless this is shown to be a terrible world-ending issue, I am closing this with "current approach is better than proposed alternatives" resolution. If somebody has better idea, I'll be happy to reconsider. |
Discussed in #934
Originally posted by jayeshv September 30, 2022
Consider the following app
for the following query, it generates two error objects.
Isn't the first error created by the cost_validator a redundant one? This duplicate error happens only with the extra validator.
ariadne version 0.16.1
The text was updated successfully, but these errors were encountered: