-
Notifications
You must be signed in to change notification settings - Fork 75
WIP Typescript OpenAPI Generator v7 #1505
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @gcatanese, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request focuses on refactoring the Typescript OpenAPI Generator to version 7. It includes updates to Mustache templates, generation of new service APIs (Checkout, Payout, Recurring, BinLookUp, DataProtection, PosMobile, PaymentsApp, SessionAuthentication), and code formatting changes to use double quotes instead of single quotes. The PR also includes updates to eslint configuration and associated tests.
Highlights
- OpenAPI Generator v7 Refactor: The core intent is to upgrade the Typescript OpenAPI Generator to version 7, bringing in new features and improvements from the generator.
- New Service API Generation: This PR generates service APIs for Checkout, Payout, Recurring, BinLookUp, DataProtection, PosMobile, PaymentsApp, and SessionAuthentication, expanding the library's capabilities.
- Template Updates: Mustache templates have been updated to align with OpenAPI Generator v7's requirements.
- Code Formatting: The code has been formatted to consistently use double quotes (") instead of single quotes ('), improving code style.
- Eslint Configuration: Eslint configuration has been updated to exclude src/typings/**/*.ts from default rules, and only apply unused-imports rule.
- SessionAuthentication API: Adds SessionAuthentication API to support
allOf
.
Changelog
Click here to see the changelog
- .eslintignore
- Removes exclusion of
/src/typings/**/*.ts
.
- Removes exclusion of
- .eslintrc.js
- Modifies eslint overrides to apply
unused-imports/no-unused-imports
rule only tosrc/typings/**/*.ts
files. - Adds a default rule set for all
.ts
files except those insrc/typings/**/*.ts
.
- Modifies eslint overrides to apply
- src/mocks/checkout/payments3DS2NativeAction.ts
- Adds a mock for
payments3DS2NativeAction
to simulate a 3DS2 Native action.
- Adds a mock for
- src/mocks/checkout/paymentsRedirectAction.ts
- Adds a mock for
paymentsRedirectAction
to simulate a shopper redirect action.
- Adds a mock for
- src/tests/binLookup.spec.ts
- Updates imports to use
BinLookupAPI
from../services
instead of../services/binLookupApi
. - Updates tests to call
BinLookupApi.get3dsAvailability
andBinLookupApi.getCostEstimate
instead of calling the methods directly on thebinLookupService
.
- Updates imports to use
- src/tests/checkout.spec.ts
- Adds imports for
paymentsRedirectAction
andpayments3DS2NativeAction
mocks. - Adds tests to check for shopper redirect and Native 3DS2 with card payments.
- Updates
ObjectSerializer.deserialize
calls to include an empty string as the third argument.
- Adds imports for
- src/tests/dataProtection.spec.ts
- Updates tests to call
DataProtectionApi.requestSubjectErasure
instead of calling the method directly on thedataProtectionService
.
- Updates tests to call
- src/tests/httpClient.spec.ts
- Updates tests to call
BinLookupApi.get3dsAvailability
instead of calling the method directly on thebinLookup
orbinLookupService
.
- Updates tests to call
- src/tests/paymentsAppApi.spec.ts
- Creates a new test suite for
PaymentsAppApi
to test boarding token generation and payments app listing/revoking.
- Creates a new test suite for
- src/tests/posMobileApi.spec.ts
- Creates a new test suite for
PosMobileApi
to test communication session creation.
- Creates a new test suite for
- src/tests/recurring.spec.ts
- Updates imports to use
RecurringAPI
from../services
instead of../services/recurringApi
. - Updates tests to call
RecurringApi.listRecurringDetails
,RecurringApi.disable
,RecurringApi.notifyShopper
,RecurringApi.scheduleAccountUpdater
,RecurringApi.createPermit
, andRecurringApi.disablePermit
instead of calling the methods directly on therecurringService
. - Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates imports to use
- src/tests/sessionAuthenticationApi.spec.ts
- Creates a new test suite for
SessionAuthenticationApi
to test authentication session creation.
- Creates a new test suite for
- src/service.ts
- Updates the condition to check for
/possdk/v68
using double quotes instead of single quotes.
- Updates the condition to check for
- src/services/binLookup/binLookupApi.ts
- Creates a new
BinLookupApi
class with methods forget3dsAvailability
andgetCostEstimate
.
- Creates a new
- src/services/binLookup/index.ts
- Creates a new
BinLookupAPI
class that exports theBinLookupApi
.
- Creates a new
- src/services/binLookupApi.ts
- Adds deprecation notice to the
BinLookupAPI
class. - Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument. - Adds deprecation notice to the
get3dsAvailability
andgetCostEstimate
methods.
- Adds deprecation notice to the
- src/services/checkout/donationsApi.ts
- Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates
- src/services/checkout/modificationsApi.ts
- Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates
- src/services/checkout/ordersApi.ts
- Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates
- src/services/checkout/paymentLinksApi.ts
- Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates
- src/services/checkout/paymentsApi.ts
- Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates
- src/services/checkout/recurringApi.ts
- Creates a new
RecurringApi
class with methods for recurring payments.
- Creates a new
- src/services/checkout/utilityApi.ts
- Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument.
- Updates
- src/services/dataProtection/dataProtectionApi.ts
- Creates a new
DataProtectionApi
class with methods for data protection requests.
- Creates a new
- src/services/dataProtection/index.ts
- Creates a new
DataProtectionAPI
class that exports theDataProtectionApi
.
- Creates a new
- src/services/dataProtectionApi.ts
- Adds deprecation notice to the
DataProtectionAPI
class. - Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument. - Adds deprecation notice to the
requestSubjectErasure
method.
- Adds deprecation notice to the
- src/services/index.ts
- Updates the barrel file to export the new services and remove the deprecated ones.
- src/services/paymentsApp/paymentsAppApi.ts
- Creates a new
PaymentsAppApi
class with methods for payments app management.
- Creates a new
- src/services/posMobile/index.ts
- Creates a new
PosMobileAPI
class that exports thePosMobileApi
.
- Creates a new
- src/services/posMobile/posMobileApi.ts
- Creates a new
PosMobileApi
class with methods for POS mobile communication.
- Creates a new
- src/services/posMobileApi.ts
- Adds deprecation notice to the
PosMobileAPI
class. - Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument. - Adds deprecation notice to the
createCommunicationSession
method.
- Adds deprecation notice to the
- src/services/recurring/index.ts
- Creates a new
RecurringAPI
class that exports theRecurringApi
.
- Creates a new
- src/services/recurring/recurringApi.ts
- Creates a new
RecurringApi
class with methods for recurring payments.
- Creates a new
- src/services/recurringApi.ts
- Adds deprecation notice to the
RecurringAPI
class. - Updates
ObjectSerializer.serialize
calls to include an empty string as the third argument. - Adds deprecation notice to the
createPermit
,disable
,disablePermit
,listRecurringDetails
,notifyShopper
, andscheduleAccountUpdater
methods.
- Adds deprecation notice to the
- src/typings/checkout
- Updates all typings to use readonly properties, and adds constructors.
- Updates all typings to use a format property on attributeTypeMap.
- Updates all typings to use string literals instead of string enums.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A generator's might,
Shapes APIs with all its force,
Typescript takes flight.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
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 significantly refactors the TypeScript SDK by upgrading to OpenAPI Generator v7. The changes are extensive and touch upon ESLint configuration, service structure, testing, and typings. Overall, the move to a newer generator version brings a more structured approach to the generated code, especially in typings and object serialization, which is a positive step.
I've focused on areas that might introduce breaking changes, potential regressions, or confusion. Please pay close attention to the comments regarding ESLint configuration, the plans
field in CheckoutSessionInstallmentOption
, and the deprecation notices in the new Recurring API.
Summary of Findings
- ESLint Configuration Overhaul: The ESLint configuration has been significantly changed, including the removal of
eslint:recommended
andplugin:@typescript-eslint/recommended
fromextends
. This requires careful verification to ensure no desired linting rules were unintentionally lost. - Potentially Breaking Change in Data Model: The
plans
field inCheckoutSessionInstallmentOption
changed fromArray<Enum>
to a singleEnum
. This could be a breaking change if the API previously supported multiple plans. - Confusing Deprecation Notices: The newly generated
RecurringApi
(v68) has methods marked with@deprecated since Adyen Recurring API v68
. This is confusing and needs clarification. - Incomplete Test Assertions: Found instances of
expect;
inhttpClient.spec.ts
which are non-functional and indicate incomplete test assertions. - ObjectSerializer Signature Change: The
ObjectSerializer.serialize
anddeserialize
methods now consistently include a thirdformat
argument (often an empty string), aligning with OpenAPI Generator v7. This change has been applied across the codebase. - Service Structure Refactoring: Services like BinLookup, DataProtection, Recurring, etc., have been refactored into a new directory structure with a wrapper API class (e.g.,
BinLookupAPI
containingBinLookupApi
). This is a consistent structural improvement. - New Services and Tests: New services (
PaymentsAppAPI
,PosMobileAPI
,SessionAuthenticationAPI
) have been added along with their initial test suites, which is good progress.
Merge Readiness
This pull request introduces substantial and important changes by upgrading to OpenAPI Generator v7. However, due to the potential impact of the ESLint configuration changes, the data model modification in CheckoutSessionInstallmentOption
, and the confusing deprecation notices in the new Recurring API, I recommend addressing these high-severity issues before merging. The incomplete test assertions should also be fixed. I am unable to approve this pull request myself; further review and approval from other maintainers will be necessary once these points are clarified and resolved.
/gemini review |
There was a problem hiding this comment.
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 significant refactor to utilize OpenAPI Generator v7, along with generating clients for new services and updating existing ones. The changes are extensive and touch upon ESLint configuration, service structure, testing, and generated typings.
Overall, the move to OpenAPI Generator v7 and the structural improvements (like dedicated ObjectSerializer
files and new service wrappers) are positive steps. However, there are a few critical areas that need attention, particularly regarding the ESLint configuration and the deprecation status of the Recurring API methods.
Key areas of feedback:
- ESLint Configuration: The removal of
extends
for recommended rule sets needs clarification to ensure linting coverage hasn't unintentionally decreased. - API Deprecation: The
@deprecated
tags on the newly generatedRecurringApi
methods are a major concern and require immediate clarification. - Typing Changes: The shift from
Type | null
toType | undefined
for optional properties in models could be a breaking change and needs confirmation. - Testing: While new tests are good, existing TODOs should be addressed.
Summary of Findings
- ESLint Configuration Overhaul: The ESLint configuration has been significantly refactored, including the removal of
extends
foreslint:recommended
andplugin:@typescript-eslint/recommended
. This needs verification to ensure no essential linting rules were inadvertently lost, potentially impacting code quality. (Severity: Critical) - Recurring API Deprecation: Methods in the newly generated
src/services/recurring/recurringApi.ts
are marked as@deprecated since Adyen Recurring API v68
. This is a major concern and requires immediate clarification on whether the API itself or just these generated signatures are deprecated, and what the implications or migration paths are. (Severity: Critical) - Typing Changes for Optional Properties (
null
vsundefined
): Optional properties in generated models seem to have changed fromType | null
toType | undefined
. This could be a breaking change ifnull
was a previously supported value. Confirmation is needed on the expected representation for absent optional values. (Severity: High) - TODOs in Tests: Several
// TODO check action is polymorphic
comments exist insrc/__tests__/checkout.spec.ts
. These should be addressed to ensure full test coverage and correctness for polymorphic action types. (Severity: Medium) - ObjectSerializer Updates: The
ObjectSerializer
has been refactored and now includes a thirdformat
argument in itsserialize
anddeserialize
methods. This is consistently applied across the codebase and appears to be an improvement from the generator. (Severity: Informational - Not commented due to settings) - New Service Structure: The introduction of wrapper API classes (e.g.,
BinLookupAPI
insrc/services/binLookup/index.ts
) экспортирующие specific API groups (e.g.,BinLookupApi
) is a good structural change, likely improving organization and usability. (Severity: Informational - Not commented due to settings) - TSLint Remnants: Some new mock files contain
/* tslint:disable */
comments. Since the project uses ESLint, these should be removed or replaced with ESLint equivalents if necessary. (Severity: Low - Not commented due to settings) - Missing Newline at End of File: Several new mock and test files are missing a newline character at the end of the file. This should be added if it's part of the project's coding standards. (Severity: Low - Not commented due to settings)
Merge Readiness
This pull request makes substantial progress in upgrading to OpenAPI Generator v7 and expanding service coverage. However, due to the critical nature of the ESLint configuration changes (potential loss of recommended rules) and the uncertainty around the RecurringApi
deprecation, I recommend that these points be thoroughly investigated and clarified before merging. Additionally, the potential breaking change regarding null
vs undefined
in model typings needs confirmation. Addressing the TODOs in tests would also be beneficial. I am unable to approve this pull request in its current state; further review and changes are requested.
06cb24e
to
975feb1
Compare
975feb1
to
23dd113
Compare
|
Refactor to use OpenAPI Generator v7:
allOf
"
instead of'