-
Notifications
You must be signed in to change notification settings - Fork 221
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 an option to limit number of errors returned #1017
Add an option to limit number of errors returned #1017
Conversation
thanks for this PR. 💯 I think that we add some methods to avoid some of those
Would you take care of it or should I? |
@@ -148,7 +156,8 @@ class ValidationContext( | |||
val schema: Schema[_, _], | |||
val doc: ast.Document, | |||
val sourceMapper: Option[SourceMapper], | |||
val typeInfo: TypeInfo) { | |||
val typeInfo: TypeInfo, | |||
errorsLimit: Option[Int] = None) { |
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.
Making errorsLimit immutable as ValidationContext
is a call.
errorsLimit: Option[Int] = None) { | |
val errorsLimit: Option[Int] = None) { |
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.
omitting val
will make it private to the class since it's not a case class, won't it? 🤔 Do we want to make it public?
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.
oh yes sorry. Keep it like this.
It looks like it will be a breaking change if we do it this way - we will not be able to call
The same with 🤔 Would we be fine introducing breaking change? |
For |
@yanns let me know if it looks better now 🙌 |
It's looking good, thanks! |
I propose to set a default limit to make default usage safe: aab5f5b |
1 similar comment
I propose to set a default limit to make default usage safe: aab5f5b |
10 sounds like a good default value! 👍 |
What?
Add an option to limit the number of errors returned.
Why?
There is a possibility that the lack of limits could be abused to induce memory pressure in the server/service handling the request and can lead to the potential denial of service (i.e. no DDoS needed).