I've seen in issue #115 that this was already debated and fixed in a previous version.
Nevertheless an issue was introduced along the way that prevents the reading of schemas with decimals without scale
Replicated this with the available unit tests, using the following schema:
{ "type": "bytes", "logicalType": "decimal", "precision": 10 }
I get the following error:
Failed Chr.Avro.Representation.Tests.JsonRepresentationTests.SymmetricRepresentations(schema: "{\"type\":\"bytes\",\"logicalType\":\"decimal\",\""...) [1 ms] Error Message: System.InvalidOperationException : Operation is not valid due to the current state of the object. Stack Trace: at System.Text.Json.JsonElement.GetInt32() at Chr.Avro.Representation.JsonDecimalSchemaReaderCase.Read(JsonElement element, JsonSchemaReaderContext context) in /dotnet-avro/src/Chr.Avro.Json/Representation/JsonDecimalSchemaReaderCase.cs:line 47 at Chr.Avro.Representation.JsonSchemaReader.Read(JsonElement element, JsonSchemaReaderContext context) in /dotnet-avro/src/Chr.Avro.Json/Representation/JsonSchemaReader.cs:line 134 at Chr.Avro.Representation.JsonSchemaReader.Read(String schema, JsonSchemaReaderContext context) in /dotnet-avro/src/Chr.Avro.Json/Representation/JsonSchemaReader.cs:line 119 at Chr.Avro.Representation.Tests.JsonRepresentationTests.SymmetricRepresentations(String schema) in /dotnet-avro/tests/Chr.Avro.Json.Tests/JsonRepresentationTests.cs:line 157 at InvokeStub_JsonRepresentationTests.SymmetricRepresentations(Object, Span1)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
`
I've seen in issue #115 that this was already debated and fixed in a previous version. Nevertheless an issue was introduced along the way that prevents the reading of schemas with decimals without scale
Replicated this with the available unit tests, using the following schema:
{ "type": "bytes", "logicalType": "decimal", "precision": 10 }
I get the following error:
Failed Chr.Avro.Representation.Tests.JsonRepresentationTests.SymmetricRepresentations(schema: "{\"type\":\"bytes\",\"logicalType\":\"decimal\",\""...) [1 ms] Error Message: System.InvalidOperationException : Operation is not valid due to the current state of the object. Stack Trace: at System.Text.Json.JsonElement.GetInt32() at Chr.Avro.Representation.JsonDecimalSchemaReaderCase.Read(JsonElement element, JsonSchemaReaderContext context) in /dotnet-avro/src/Chr.Avro.Json/Representation/JsonDecimalSchemaReaderCase.cs:line 47 at Chr.Avro.Representation.JsonSchemaReader.Read(JsonElement element, JsonSchemaReaderContext context) in /dotnet-avro/src/Chr.Avro.Json/Representation/JsonSchemaReader.cs:line 134 at Chr.Avro.Representation.JsonSchemaReader.Read(String schema, JsonSchemaReaderContext context) in /dotnet-avro/src/Chr.Avro.Json/Representation/JsonSchemaReader.cs:line 119 at Chr.Avro.Representation.Tests.JsonRepresentationTests.SymmetricRepresentations(String schema) in /dotnet-avro/tests/Chr.Avro.Json.Tests/JsonRepresentationTests.cs:line 157 at InvokeStub_JsonRepresentationTests.SymmetricRepresentations(Object, Span
1) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) `