Skip to content

Commit 6afe406

Browse files
authored
Merge pull request #929 from BoltDoggy/patch-1
Fix route regex pattern in route name generation
2 parents bd12a16 + 1e2e00e commit 6afe406

File tree

13 files changed

+1711
-2120
lines changed

13 files changed

+1711
-2120
lines changed

.changeset/orange-dogs-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
Fix route regex pattern in route name generation.

templates/base/route-name.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const methodAliases = {
2323
};
2424
2525
const createCustomOperationId = (method, route, moduleName) => {
26-
const hasPathInserts = /\{(\w){1,}\}/g.test(route);
26+
const hasPathInserts = /\{(\w){1,}\}$/g.test(route);
2727
const splittedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/"));
2828
const routeParts = (splittedRouteBySlash.length > 1
2929
? splittedRouteBySlash.splice(1)

tests/__snapshots__/extended.test.ts.snap

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59295,7 +59295,7 @@ export enum StepModeEnum {
5929559295
Other = "other",
5929659296
}
5929759297

59298-
export type StopDetailData = Step[];
59298+
export type StopListData = Step[];
5929959299

5930059300
export interface Trip {
5930159301
/**
@@ -59321,19 +59321,19 @@ export type TripListData = Trip[];
5932159321
export namespace Trip {
5932259322
/**
5932359323
* @description list stops for a trip identified by {trip_id}
59324-
* @name StopDetail
59324+
* @name StopList
5932559325
* @request GET:/trip/{trip_id}/stop
5932659326
* @secure
5932759327
*/
59328-
export namespace StopDetail {
59328+
export namespace StopList {
5932959329
export type RequestParams = {
5933059330
/** id of the trip */
5933159331
tripId: string;
5933259332
};
5933359333
export type RequestQuery = {};
5933459334
export type RequestBody = never;
5933559335
export type RequestHeaders = {};
59336-
export type ResponseBody = StopDetailData;
59336+
export type ResponseBody = StopListData;
5933759337
}
5933859338

5933959339
/**
@@ -59577,12 +59577,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
5957759577
/**
5957859578
* @description list stops for a trip identified by {trip_id}
5957959579
*
59580-
* @name StopDetail
59580+
* @name StopList
5958159581
* @request GET:/trip/{trip_id}/stop
5958259582
* @secure
5958359583
*/
59584-
stopDetail: (tripId: string, params: RequestParams = {}) =>
59585-
this.request<StopDetailData, any>({
59584+
stopList: (tripId: string, params: RequestParams = {}) =>
59585+
this.request<StopListData, any>({
5958659586
path: \`/trip/\${tripId}/stop\`,
5958759587
method: "GET",
5958859588
secure: true,
@@ -69761,9 +69761,9 @@ export interface ListWebhooksResponse {
6976169761
};
6976269762
}
6976369763

69764-
export type LogsDetailData = ListWebhookDeliveryLogsResponse;
69764+
export type LogsListData = ListWebhookDeliveryLogsResponse;
6976569765

69766-
export interface LogsDetailParams {
69766+
export interface LogsListParams {
6976769767
/**
6976869768
* The number of records to return in each page.
6976969769
* @example 30
@@ -70016,7 +70016,9 @@ export enum TransactionStatusEnum {
7001670016

7001770017
export type TransactionsDetailData = GetTransactionResponse;
7001870018

70019-
export interface TransactionsDetailParams1 {
70019+
export type TransactionsListData = ListTransactionsResponse;
70020+
70021+
export interface TransactionsListParams {
7002070022
/**
7002170023
* The category identifier for which to filter transactions.
7002270024
* Both parent and child categories can be filtered through
@@ -70060,18 +70062,11 @@ export interface TransactionsDetailParams1 {
7006070062
* @example 30
7006170063
*/
7006270064
"page[size]"?: number;
70063-
/**
70064-
* The unique identifier for the account.
70065-
* @example "86150b64-feaa-4186-a7e4-e84eae764602"
70066-
*/
70067-
accountId: string;
70065+
/** Blablabla bla */
70066+
someEnumName?: SomeEnumName;
7006870067
}
7006970068

70070-
export type TransactionsDetailResult = ListTransactionsResponse;
70071-
70072-
export type TransactionsListData = ListTransactionsResponse;
70073-
70074-
export interface TransactionsListParams {
70069+
export interface TransactionsListParams2 {
7007570070
/**
7007670071
* The category identifier for which to filter transactions.
7007770072
* Both parent and child categories can be filtered through
@@ -70115,10 +70110,15 @@ export interface TransactionsListParams {
7011570110
* @example 30
7011670111
*/
7011770112
"page[size]"?: number;
70118-
/** Blablabla bla */
70119-
someEnumName?: SomeEnumName;
70113+
/**
70114+
* The unique identifier for the account.
70115+
* @example "86150b64-feaa-4186-a7e4-e84eae764602"
70116+
*/
70117+
accountId: string;
7012070118
}
7012170119

70120+
export type TransactionsListResult = ListTransactionsResponse;
70121+
7012270122
/** Request to add or remove tags associated with a transaction. */
7012370123
export interface UpdateTransactionTagsRequest {
7012470124
/** The tags to add to or remove from the transaction. */
@@ -70385,12 +70385,12 @@ export namespace Accounts {
7038570385
/**
7038670386
* @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last.
7038770387
* @tags Transactions
70388-
* @name TransactionsDetail
70388+
* @name TransactionsList
7038970389
* @summary List transactions by account
7039070390
* @request GET:/accounts/{accountId}/transactions
7039170391
* @secure
7039270392
*/
70393-
export namespace TransactionsDetail {
70393+
export namespace TransactionsList {
7039470394
export type RequestParams = {
7039570395
/**
7039670396
* The unique identifier for the account.
@@ -70445,7 +70445,7 @@ export namespace Accounts {
7044570445
};
7044670446
export type RequestBody = never;
7044770447
export type RequestHeaders = {};
70448-
export type ResponseBody = TransactionsDetailResult;
70448+
export type ResponseBody = TransactionsListResult;
7044970449
}
7045070450
}
7045170451

@@ -70673,12 +70673,12 @@ export namespace Webhooks {
7067370673
/**
7067470674
* @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time.
7067570675
* @tags Webhooks
70676-
* @name LogsDetail
70676+
* @name LogsList
7067770677
* @summary List webhook logs
7067870678
* @request GET:/webhooks/{webhookId}/logs
7067970679
* @secure
7068070680
*/
70681-
export namespace LogsDetail {
70681+
export namespace LogsList {
7068270682
export type RequestParams = {
7068370683
/**
7068470684
* The unique identifier for the webhook.
@@ -70695,7 +70695,7 @@ export namespace Webhooks {
7069570695
};
7069670696
export type RequestBody = never;
7069770697
export type RequestHeaders = {};
70698-
export type ResponseBody = LogsDetailData;
70698+
export type ResponseBody = LogsListData;
7069970699
}
7070070700

7070170701
/**
@@ -71067,13 +71067,13 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
7106771067
* @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last.
7106871068
*
7106971069
* @tags Transactions
71070-
* @name TransactionsDetail
71070+
* @name TransactionsList
7107171071
* @summary List transactions by account
7107271072
* @request GET:/accounts/{accountId}/transactions
7107371073
* @secure
7107471074
*/
71075-
transactionsDetail: ({ accountId, ...query }: TransactionsDetailParams1, params: RequestParams = {}) =>
71076-
this.request<TransactionsDetailResult, any>({
71075+
transactionsList: ({ accountId, ...query }: TransactionsListParams2, params: RequestParams = {}) =>
71076+
this.request<TransactionsListResult, any>({
7107771077
path: \`/accounts/\${accountId}/transactions\`,
7107871078
method: "GET",
7107971079
query: query,
@@ -71240,13 +71240,13 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
7124071240
* @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time.
7124171241
*
7124271242
* @tags Webhooks
71243-
* @name LogsDetail
71243+
* @name LogsList
7124471244
* @summary List webhook logs
7124571245
* @request GET:/webhooks/{webhookId}/logs
7124671246
* @secure
7124771247
*/
71248-
logsDetail: ({ webhookId, ...query }: LogsDetailParams, params: RequestParams = {}) =>
71249-
this.request<LogsDetailData, any>({
71248+
logsList: ({ webhookId, ...query }: LogsListParams, params: RequestParams = {}) =>
71249+
this.request<LogsListData, any>({
7125071250
path: \`/webhooks/\${webhookId}/logs\`,
7125171251
method: "GET",
7125271252
query: query,

tests/__snapshots__/simple.test.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36145,11 +36145,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
3614536145
/**
3614636146
* @description list stops for a trip identified by {trip_id}
3614736147
*
36148-
* @name StopDetail
36148+
* @name StopList
3614936149
* @request GET:/trip/{trip_id}/stop
3615036150
* @secure
3615136151
*/
36152-
stopDetail: (tripId: string, params: RequestParams = {}) =>
36152+
stopList: (tripId: string, params: RequestParams = {}) =>
3615336153
this.request<Step[], any>({
3615436154
path: \`/trip/\${tripId}/stop\`,
3615536155
method: "GET",
@@ -44828,12 +44828,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
4482844828
* @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last.
4482944829
*
4483044830
* @tags Transactions
44831-
* @name TransactionsDetail
44831+
* @name TransactionsList
4483244832
* @summary List transactions by account
4483344833
* @request GET:/accounts/{accountId}/transactions
4483444834
* @secure
4483544835
*/
44836-
transactionsDetail: (
44836+
transactionsList: (
4483744837
accountId: string,
4483844838
query?: {
4483944839
/**
@@ -45219,12 +45219,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
4521945219
* @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time.
4522045220
*
4522145221
* @tags Webhooks
45222-
* @name LogsDetail
45222+
* @name LogsList
4522345223
* @summary List webhook logs
4522445224
* @request GET:/webhooks/{webhookId}/logs
4522545225
* @secure
4522645226
*/
45227-
logsDetail: (
45227+
logsList: (
4522845228
webhookId: string,
4522945229
query?: {
4523045230
/**

0 commit comments

Comments
 (0)