christianhelle / refitter

Refit Client API Generator for OpenAPI
https://refitter.github.io
MIT License
156 stars 36 forks source link

Polly.Extensions.Http deprecated in favour of Microsoft.Extensions.Http.Resilience #398

Closed dammitjanet closed 1 week ago

dammitjanet commented 2 weeks ago

Is your feature request related to a problem? Please describe.

Generating refitter with ' "usePolly": true,' results in the use of the deprecated package Polly.Extensions.Http

Describe the solution you'd like Update refitter to use Microsoft.Extensions.Http.Resilience and generate compatible code

Describe alternatives you've considered n/a

Additional context n/a

christianhelle commented 2 weeks ago

@dammitjanet thanks for taking the time to bring this up

Would you happen to know if the usage differs? I mean, can the generated Polly.Extensions.Http usage work on Microsoft.Extensions.Http.Resilience ?

Maybe we should also rename the option usePolly to httpResilience, or handleTransientErrors, or somethingElse

dammitjanet commented 2 weeks ago

@christianhelle

Would you happen to know if the usage differs? I mean, can the generated Polly.Extensions.Http work on Microsoft.Extensions.Http.Resilience ?

No it's not, and the dependencies are obscure and obtuse. I spent about an hour trying to work out the dependencies, and couldn't find any kind of guide to assist in the migration and then decided spending a day updating my code form the API spec manually was the better way to spend my time

Maybe we should also rename the option usePolly to httpResilience, or handleTransientErrors, or somethingElse

if you can work it out, then i'd think perhaps deprecating usePolly to handleTransientErrors with acceptable values of

christianhelle commented 2 weeks ago

No it's not, and the dependencies are obscure and obtuse. I spent about an hour trying to work out the dependencies, and couldn't find any kind of guide to assist in the migration and then decided spending a day updating my code form the API spec manually was the better way to spend my time

I stumbled upon https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.Http.Resilience and it somewhat smells like Polly. I'll give it a shot tonight

if you can work it out, then i'd think perhaps deprecating usePolly to handleTransientErrors with acceptable values of

  • None
  • Polly
  • HttpResilience

I like it. I'll go with that

Thanks for the suggestions