Closed hyuraku closed 2 years ago
Thank you @hyuraku, one thing I'm not entirely happy about is that the existing warnings not only communicate which method has been deprecated and from where it was called, but they also provide a hint as to how to address them, and a link to the relevant documentation.
Simply replacing them with Faraday::Deprecate
will make that information disappear 😢
Do you think it would be possible to extend #deprecate
so that it accepts an additional (optional) parameter that we can use to provide a "custom message" on some deprecation warnings, and use that new parameter in these cases?
@iMacTia
Do you think it would be possible to extend
#deprecate
so that it accepts an additional (optional) parameter that we can use to provide a "custom message" on some deprecation warnings, and use that new parameter in these cases?
I guess it's better to add custom_message
as the args to Faraday::Deprecate#deprecate
, How about?
Before change
def deprecate(name, repl, ver)
--< omitted >--
msg = [
"NOTE: #{target_message} is deprecated",
repl == :none ? ' with no replacement' : "; use #{repl} instead. ",
"It will be removed in or after version #{gem_ver}",
"\n#{target}#{name} called from #{Gem.location_of_caller.join(':')}"
]
After change
def deprecate(name, repl, ver, custom_message)
--< omitted >--
msg = [
"NOTE: #{target_message} is deprecated",
repl == :none ? ' with no replacement' : "; use #{repl} instead. ",
"It will be removed in or after version #{gem_ver}",
custom_message
"\n#{target}#{name} called from #{Gem.location_of_caller.join(':')}"
]
end
Yeah, that would be perfect to share the link to the documentation or any other free-text valuable context on the deprecation 🙏!
@iMacTia Could you review this PR again?
Description
apply
Faraday#deprecate
to three deprecated methods for version 2.0.Request#method
Connection#token_auth
Connection#authorization
related with https://github.com/lostisland/faraday/pull/1438
Todos
List any remaining work that needs to be done, i.e:
Additional Notes
Optional section