Option to provide PrepareRequest etc. in base class for SwaggertoCSharpClientGenerator ?
#1,333 opened on May 19, 2018
Repository metrics
- Stars
- (6,291 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Hi,
I would like an option so below methods are not partial but instead expected to be provided in a base class
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
This since I use multiple clients from x versions of a swagger document, but they all share common base class (which I want use to log the requests with and add auth headers).
The current workaround I'm aware of is to create a dummy client for each generated client, just to invoke the base class dito of above partial method, which starts to pile up when I use generate 1 client per endpoint/resource.
(I guess this is sortof a light version of #1061 ?)
Maybe similar to GenerateUpdateJsonSerializerSettingsMethod, a new option something like GenerateRequestResponseProcessMethods or similar to define behavior of having them as partial or not?
Thanks.