You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Emanuele Sabellico (Jira)" <ji...@apache.org> on 2023/09/28 08:04:00 UTC
[jira] [Updated] (AVRO-3856) Cannot parse Avro schemas for a record with depth less than the default maximum of 64 in C#
[ https://issues.apache.org/jira/browse/AVRO-3856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emanuele Sabellico updated AVRO-3856:
-------------------------------------
Description:
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 could 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]
Alternative solution is to configure Json max depth so it corresponds to an Avro schema for a 64 levels depth record.
was:
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]
Summary: Cannot parse Avro schemas for a record with depth less than the default maximum of 64 in C# (was: Cannot customize MaxDepth when parsing Avro schema in C#)
> Cannot parse Avro schemas for a record with depth less than the default maximum of 64 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
> Labels: pull-request-available
> Time Spent: 2h 50m
> Remaining Estimate: 0h
>
> 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 could 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]
> Alternative solution is to configure Json max depth so it corresponds to an Avro schema for a 64 levels depth record.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)