Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mustache template: Only add the deprecation message to the Obsolete-tag if it exists #1068

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

Kwok-he-Chu
Copy link
Contributor

@Kwok-he-Chu Kwok-he-Chu commented Oct 8, 2024

Description
This PR addresses the [Obsolete]-tag in the model and service mustache templates. These should only be shown if the message is available in the specs.

Tested scenarios

Example with CardDetails.cupsecureplusSmscode

Before:

[Obsolete("Deprecated since Adyen Checkout API v -")]

After:

[Obsolete("")]

I kept the template easy-to-read, I didn't want to make an exception for the empty case, e.g. just[Obsolete] without the double quotes and brackets ("")


Example with just the deprecation version:

[Obsolete("Deprecated since Adyen Checkout API v37.")]
        Model.Checkout.PaymentSetupResponse PaymentSession(PaymentSetupRequest paymentSetupRequest = default, RequestOptions requestOptions = default);

Example with the deprecation message and version:

[Obsolete("Deprecated since Adyen Checkout API v49. Use `storedPaymentMethodId` instead.")]
        public string RecurringDetailReference { get; set; }

Copy link

@gcatanese gcatanese left a comment

Choose a reason for hiding this comment

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

Changes are fine.

Keep into consideration that for the endpoints there is the x-deprecatedInVersion extension without vendorExtensions.x-deprecatedMessage, in this case the formatting could look wrong.
Suggestions:

  • check also if x-deprecatedMessage is available
  • format the message differently, instead of using - use a .

Copy link

sonarcloud bot commented Oct 8, 2024

Copy link

@gcatanese gcatanese left a comment

Choose a reason for hiding this comment

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

Changes are good

If you like check the changes in Java app where I have updated the templates to check separately for the 2 extensions (without assuming message is provided when version is found)

Adyen/adyen-java-api-library@be75d2d

@Kwok-he-Chu Kwok-he-Chu merged commit 5ce97d0 into main Oct 11, 2024
6 checks passed
@Kwok-he-Chu Kwok-he-Chu deleted the add-obsolete-message-if-exists branch October 11, 2024 13:33
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.

3 participants