It isn't obvious from the documentation how this should be done. An example similar to the following in the documentation (docs\site\Writerside) will make things clearer - with a link to the sample code at \samples\AotTrimmedSample
using System.Text.Json;
using System.Text.Json.Serialization;
using Vogen;
var options = new JsonSerializerOptions
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.KebabCaseLower,
Converters =
{
new VogenTypesFactory()
}
};
var foo = new Foo(Test.From("abc"));
var ctx = new JsonContext(options);
Console.WriteLine(JsonSerializer.Serialize(foo, ctx.Foo));
public record Foo(Test TestValueObject);
[ValueObject<string>]
public readonly partial struct Test;
[JsonSerializable(typeof(Foo))]
public partial class JsonContext : JsonSerializerContext;
Describe the feature
It isn't obvious from the documentation how this should be done. An example similar to the following in the documentation (
docs\site\Writerside
) will make things clearer - with a link to the sample code at\samples\AotTrimmedSample
... produces