Skip to content

Feature: add warnings for deprecated methods - #397

Merged
mrcromero merged 1 commit into
mainfrom
feature/deprecation-warnings
Aug 10, 2026
Merged

Feature: add warnings for deprecated methods#397
mrcromero merged 1 commit into
mainfrom
feature/deprecation-warnings

Conversation

@mrcromero

@mrcromero mrcromero commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Currently, deprecation appears in ruby only via a comment in the associated method. However, since this isn't explicit on the client-side, deprecation might silently be missed, and dropping of endpoints/methods may come without warning.

Description
This creates a deprecation helper-module to emit warnings for deprecated methods + updates generation templates to use it. Library has been regenerated, tests added, updated README. Additionally, added YARD metadata tags -> helps IDEs identify the methods as deprecated.

Though rubygems has Gem::Deprecate for this functionality, it's designed for warning and then delegating to an alternative, which doesn't fit this libraries' use-case. I also wanted the warning to exhibit the same information as the existing comment (deprecation version, point to alternative API) which the former doesn't support.

Additional notes:

  • It's in the README as well: deprecation warnings are hidden by default in Ruby, but also included knobs to disable only this library's warnings:
    • Adyen::Deprecation.silenced = true in the Ruby app
    • or setting env variable ADYEN_SILENCE_DEPRECATIONS to 1, true, or yes
  • posTerminalManagement.rb and hmac_validator.rb had some deprecated code that wasn't updated after generation because the former is out of the generation list (deprecated API) and the latter is manual code. Updated both manually.
  • There's an extra workaround to support older versions of ruby (ruby 2.7 doesn't support emitting warnings with categories, that's what CATEGORY_SUPPORT is for). If we decide to move along with 3.3+, then this can be dropped.

Example of what the warnings will look like to the user:

/tmp/deprecation_user_view.rb:18: warning: [DEPRECATED] `origin_keys` is deprecated since Adyen Checkout API v67

Tested scenarios

  • Tested one deprecated: that the warning is emitted but the call still succeeds
  • Tested formatting, logic of deprecation-helper, and that a warning appears

@mrcromero
mrcromero requested a review from a team as a code owner August 4, 2026 15:11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deprecation warning mechanism for deprecated API methods, updating the Mustache templates to automatically generate deprecation warnings and updating several API clients accordingly. The review feedback suggests avoiding Gem::Version for Ruby version checks to eliminate unnecessary RubyGems dependencies, and recommends using Kernel.warn instead of calling Warning.warn directly to ensure custom warning handlers are respected.

Comment thread lib/adyen/deprecation.rb Outdated
Comment thread lib/adyen/deprecation.rb Outdated
@mrcromero
mrcromero force-pushed the feature/deprecation-warnings branch 4 times, most recently from 34a7a71 to 8b5e205 Compare August 6, 2026 09:52

@gcatanese gcatanese left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, both solution and documentation. I found one potential problem, pls have a look. Thanks

Comment thread templates/api.mustache Outdated
Comment thread templates/api-small.mustache Outdated
@mrcromero
mrcromero requested a review from gcatanese August 7, 2026 11:18
@mrcromero
mrcromero force-pushed the feature/deprecation-warnings branch from 52a7d9f to e042df2 Compare August 10, 2026 08:31
@sonarqubecloud

Copy link
Copy Markdown

@mrcromero
mrcromero added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 9ff3004 Aug 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants