HttpClientCodeGenerator
HttpClientCodeGenerator copied to clipboard
Support System.Text.Json source generator contexts
With System.Text.Json adding a source generator to version 6, it would be nice if this could generate HttpClient code which could use the generated JsonSerializerContext
and JsonTypeInfo<>
types. I'm not entirely sure the best ways to add this, but I think some ways to do this would be to allow an option to accept JsonSerializerContext
as a constructor argument, allow the method to accept an IObjectSerializer
which can perform the serialization itself, allow returning the HttpContent
directly, or allow the method to take in a JsonSerializerContext
or a JsonTypeInfo<TRequest>
and JsonTypeInfo<TResult>