Conversation
There was a problem hiding this comment.
Pull request overview
This PR converts Python model files to TypeScript interface definitions as part of version 5.0.1-beta-2. The changes replace Pydantic-based Python classes with TypeScript interfaces, transforming the codebase from Python to TypeScript for API model definitions.
Changes:
- Converted Python model classes to TypeScript interfaces across multiple files
- Replaced Python type annotations (StrictStr, StrictInt, etc.) with TypeScript types (str, int, float, bool)
- Transformed Pydantic enum validators into TypeScript const enums with type definitions
- Added new API initialization file for TypeScript exports
Reviewed changes
Copilot reviewed 133 out of 571 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| cashfree_pg/models/instrument_webhook_data_entity.py | Converted Python Pydantic model to TypeScript interface |
| cashfree_pg/models/instrument_webhook_data.py | Converted Python model to TypeScript with type annotations changed from Python to TypeScript syntax |
| cashfree_pg/models/instrument_entity.py | Converted Python model with enum validators to TypeScript interface with const enum definitions |
| cashfree_pg/models/idempotency_error.py | Converted Python model to TypeScript interface with enum type definition |
| cashfree_pg/models/disputes_entity_merchant_accepted.py | Converted complex Python model with multiple enums to TypeScript interface |
| cashfree_pg/models/discount_details.py | Converted Python model with enum validator to TypeScript interface with enum definition |
| cashfree_pg/api/init.py | Added new TypeScript API initialization file with imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'event_time'?: str; | ||
| /** | ||
| * | ||
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'type'?: str; |
There was a problem hiding this comment.
TypeScript type annotations are using Python type names. In TypeScript, primitive types should be lowercase: 'string' instead of 'str', 'number' instead of 'int' or 'float', and 'boolean' instead of 'bool'. This pattern appears throughout all converted files and will cause TypeScript compilation errors.
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: str; | |
| /** | |
| * | |
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: str; | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: string; | |
| /** | |
| * | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: string; |
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'event_time'?: str; | ||
| /** | ||
| * | ||
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'type'?: str; |
There was a problem hiding this comment.
TypeScript type annotations are using Python type names. In TypeScript, primitive types should be lowercase: 'string' instead of 'str', 'number' instead of 'int' or 'float', and 'boolean' instead of 'bool'. This pattern appears throughout all converted files and will cause TypeScript compilation errors.
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: str; | |
| /** | |
| * | |
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: str; | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: string; | |
| /** | |
| * | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: string; |
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'cf_settlement_ids'?: List[str]; | ||
| /** | ||
| * List of settlement UTRs for which you want the settlement reconciliation details. | ||
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'settlement_utrs'?: List[str]; | ||
| /** | ||
| * Specify the start date from when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'start_date'?: str; | ||
| /** | ||
| * Specify the end date till when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'end_date'?: str; |
There was a problem hiding this comment.
TypeScript uses 'Array' or 'T[]' syntax for arrays, not Python's 'List[T]' syntax. These should be 'Array' or 'string[]' to be valid TypeScript.
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: List[str]; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: List[str]; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: str; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: str; | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: Array<string>; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: Array<string>; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: string; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: string; |
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'cf_settlement_ids'?: List[str]; | ||
| /** | ||
| * List of settlement UTRs for which you want the settlement reconciliation details. | ||
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'settlement_utrs'?: List[str]; | ||
| /** | ||
| * Specify the start date from when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'start_date'?: str; | ||
| /** | ||
| * Specify the end date till when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'end_date'?: str; |
There was a problem hiding this comment.
TypeScript uses 'Array' or 'T[]' syntax for arrays, not Python's 'List[T]' syntax. These should be 'Array' or 'string[]' to be valid TypeScript.
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: List[str]; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: List[str]; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: str; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: str; | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: Array<string>; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: Array<string>; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: string; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: string; |
| * @type {object} | ||
| * @memberof ESOrderReconResponseDataInnerOrderSplitsInnerSplitInner | ||
| */ | ||
| 'tags'?: object; |
There was a problem hiding this comment.
The 'object' type in TypeScript should be lowercase and typically 'Record<string, any>' or a specific interface would be more appropriate for better type safety.
| * @type {object} | |
| * @memberof ESOrderReconResponseDataInnerOrderSplitsInnerSplitInner | |
| */ | |
| 'tags'?: object; | |
| * @type {Record<string, any>} | |
| * @memberof ESOrderReconResponseDataInnerOrderSplitsInnerSplitInner | |
| */ | |
| 'tags'?: Record<string, any>; |
| 'instrument_meta'?: SavedInstrumentMeta; | ||
| } | ||
|
|
||
| export const Instrument_typeEnum = { |
There was a problem hiding this comment.
TypeScript enum naming convention uses PascalCase, not snake_case. These should be renamed to 'InstrumentTypeEnum' for consistency with TypeScript best practices.
| 'unknown_default_open_api': 'unknown_default_open_api' | ||
| } as const; | ||
|
|
||
| export type Instrument_typeEnum = typeof Instrument_typeEnum[keyof typeof Instrument_typeEnum]; |
There was a problem hiding this comment.
TypeScript enum naming convention uses PascalCase, not snake_case. These should be renamed to 'InstrumentTypeEnum' for consistency with TypeScript best practices.
| # flake8: noqa | ||
|
|
||
| # import apis into api package |
There was a problem hiding this comment.
This file appears to contain Python-style imports in a TypeScript conversion PR. The file extension is .py but the content seems intended for TypeScript. Either the file extension should be .ts or the imports should use TypeScript syntax (import/export statements).
Raising PR to github