You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Edmond Wong (Jira)" <ji...@apache.org> on 2023/09/21 18:20:00 UTC
[jira] [Commented] (AVRO-3856) Cannot customize MaxDepth when parsing Avro schema in C#
[ https://issues.apache.org/jira/browse/AVRO-3856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767674#comment-17767674 ]
Edmond Wong commented on AVRO-3856:
-----------------------------------
I am the end developer whom contacted Confluent for the issue where I needed to consume message with Avro schema more than 64 depth levels. I also have a pull request to Newtonsoft, [https://github.com/JamesNK/Newtonsoft.Json/pull/2904/files] for the fixes. The PR is in open status at the moment for merging.
On the other hand, I notice Microsoft's System.Text.Json.Nodes has a Parse method with JsonDocumentOption as a parameter that support overriding the default MaxDepth.
> Cannot customize MaxDepth when parsing Avro schema in C#
> --------------------------------------------------------
>
> Key: AVRO-3856
> URL: https://issues.apache.org/jira/browse/AVRO-3856
> Project: Apache Avro
> Issue Type: Bug
> Components: csharp
> Affects Versions: 1.11.2
> Reporter: Emanuele Sabellico
> Priority: Minor
>
> When parsing the Avro Schema with Newtonsoft.Json max depth is limited to 64, the default. It cannot be customized because it's using JObject.Parse that doesn't allow to customize it.
> Using JsonConvert can allow to change default MaxDepth
> {code:c#}
> JsonConvert.DefaultSettings = () =>
> {
> return new JsonSerializerSettings
> {
> MaxDepth = 100
> };
> };
> var schema = File.ReadAllText("schema.avsc");
> var json = JsonConvert.DeserializeObject<JObject>(schema);
> {code}
> [https://github.com/apache/avro/blob/41b3c08ca5da192786c2b08546e691b3126e1856/lang/csharp/src/apache/main/Schema/Schema.cs#L250]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)