-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Added MaxDepth property to JsonLoadSettings to override the maxDepth … #2904
base: master
Are you sure you want to change the base?
Conversation
…of 64 levels limit in JsonReader when the reader is called by JObject.Parse, or JArray.Parse.
Hi, this is a fix for Issue #2900 |
Co-authored-by: Ivan Maximov <[email protected]>
I really need the issue fixed soon because I do have an Avro schema from the source team who cannot reduce the depth level the document from a vendor. I am open to alternative if my fix is not good enough. Please help. |
@tradercentric if you in a hurry I really advise you to fork and compile your version. You may wait for applying/releasing for ages. |
I don't think this feature is valuable. There is already a Having a setting on JsonLoadSettings for max depth creates confusion about which is used. And then the question comes up whether all the other settings on JsonReader should be added to JsonLoadSettings. |
Thanks for the response. I am an user of the Apache Avro project which is using Newtonsoft's library, I will fork the Apache Avro project and see if I can instantiate JsonReader first before (to customize) before using JObject.Parse and JArray.Parse. That is to resolve the issue in https://github.com/apache/avro/blob/41b3c08ca5da192786c2b08546e691b3126e1856/lang/csharp/src/apache/main/Schema/Schema.cs#L250. |
JsonReader.Load seems to count differently the depth levels of Avro schema, the following Avro schema has depth level 4. However in JsonReader's Push(JsonContainerType value), when I put a break point on the line "if (_maxDepth != null && Depth + 1 > _maxDepth && !_hasExceededMaxDepth)", it counted 11. Here are the observation of over-counting depth level in Newtonsoft's JsonReader: Here is the sample Avro schema for the test: var json = @"{ I also tested a 32 depth level Avro schema, and the Push method internal depth level count is 92. Here is the 32 level depth Avro schema: { |
…of 64 levels limit in JsonReader when the reader is called by JObject.Parse, or JArray.Parse.