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>
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
JsonSerializerContextandJsonTypeInfo<>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 acceptJsonSerializerContextas a constructor argument, allow the method to accept anIObjectSerializerwhich can perform the serialization itself, allow returning theHttpContentdirectly, or allow the method to take in aJsonSerializerContextor aJsonTypeInfo<TRequest>andJsonTypeInfo<TResult>