Nuget Package
Json.More.Net
Package Version
1.9.0
Can this library make doing something simpler?
Hello!
Thanks for the cool library, that it is powered by System.Text.Json. Recently I tried to use this library in a net 8 application compiled in NativeAOT, and everything works if you do JsonSchemaBuilder().FromType<T>().Build();
Then I tried parsing the schema from the file as JsonSchema.FromText(schema, options); but this unfortunately doesn't work in NativeAOT, there are two problems:
-
You need to create a custom converter for type JsonConverter<Dictionary<string, JsonSchema>> - that's pretty simple and after that the second problem occurs -
-
Method Copy In file json-everything/Json.More/JsonNodeExtensions.cs:195 calls Deserialize without passing there JsonSerializerOptions options that are used to work in NativeAOT, and it fails InvalidOperationException(JsonSerializerIsReflectionDisabled). This happens when calling GetConstraint from ExamplesKeyword.
It would be great if you could pass the JsonSerializerOptions options parameter in there, in this case your library will be able to parse schemas from string in NativeAOT mode.
Thanks!
Describe alternatives you've considered.
No response
Is there any other information you'd like to share regarding this enhancement?
No response
Code of Conduct
Nuget Package
Json.More.Net
Package Version
1.9.0
Can this library make doing something simpler?
Hello!
Thanks for the cool library, that it is powered by System.Text.Json. Recently I tried to use this library in a net 8 application compiled in NativeAOT, and everything works if you do
JsonSchemaBuilder().FromType<T>().Build();Then I tried parsing the schema from the file as
JsonSchema.FromText(schema, options);but this unfortunately doesn't work in NativeAOT, there are two problems:You need to create a custom converter for type
JsonConverter<Dictionary<string, JsonSchema>>- that's pretty simple and after that the second problem occurs -Method
CopyIn filejson-everything/Json.More/JsonNodeExtensions.cs:195calls Deserialize without passing thereJsonSerializerOptions optionsthat are used to work in NativeAOT, and it failsInvalidOperationException(JsonSerializerIsReflectionDisabled). This happens when callingGetConstraintfromExamplesKeyword.It would be great if you could pass the JsonSerializerOptions options parameter in there, in this case your library will be able to parse schemas from string in NativeAOT mode.
Thanks!
Describe alternatives you've considered.
No response
Is there any other information you'd like to share regarding this enhancement?
No response
Code of Conduct