diff --git a/integration-tests-definitions/todo-lists.yaml b/integration-tests-definitions/todo-lists.yaml index d58aa57a5..b629c73d5 100644 --- a/integration-tests-definitions/todo-lists.yaml +++ b/integration-tests-definitions/todo-lists.yaml @@ -10,13 +10,17 @@ paths: schema: type: string format: date-time - - name: status + - name: statuses in: query schema: - type: string - enum: - - incomplete - - complete + $ref: '#/components/schemas/Statuses' + - name: tags + in: query + schema: + type: array + items: + type: + string get: operationId: getTodoLists responses: @@ -174,7 +178,13 @@ components: updated: type: string format: date-time - + Statuses: + type: array + items: + type: string + enum: + - incomplete + - complete parameters: listId: name: listId diff --git a/integration-tests/typescript-angular/src/generated/todo-lists.yaml/client.service.ts b/integration-tests/typescript-angular/src/generated/todo-lists.yaml/client.service.ts index b2b626c6f..c17911ee6 100644 --- a/integration-tests/typescript-angular/src/generated/todo-lists.yaml/client.service.ts +++ b/integration-tests/typescript-angular/src/generated/todo-lists.yaml/client.service.ts @@ -2,7 +2,12 @@ /* tslint:disable */ /* eslint-disable */ -import { t_CreateUpdateTodoList, t_Error, t_TodoList } from "./models" +import { + t_CreateUpdateTodoList, + t_Error, + t_Statuses, + t_TodoList, +} from "./models" import { HttpClient, HttpParams, HttpResponse } from "@angular/common/http" import { Injectable } from "@angular/core" import { Observable } from "rxjs" @@ -89,14 +94,16 @@ export class ApiClient { getTodoLists( p: { created?: string - status?: "incomplete" | "complete" + statuses?: t_Statuses + tags?: string[] } = {}, ): Observable< (HttpResponse & { status: 200 }) | HttpResponse > { const params = this._queryParams({ created: p["created"], - status: p["status"], + statuses: p["statuses"], + tags: p["tags"], }) return this.httpClient.request("GET", this.config.basePath + `/list`, { diff --git a/integration-tests/typescript-angular/src/generated/todo-lists.yaml/models.ts b/integration-tests/typescript-angular/src/generated/todo-lists.yaml/models.ts index 28740557b..ba4801458 100644 --- a/integration-tests/typescript-angular/src/generated/todo-lists.yaml/models.ts +++ b/integration-tests/typescript-angular/src/generated/todo-lists.yaml/models.ts @@ -11,6 +11,8 @@ export type t_CreateUpdateTodoList = { name: string } +export type t_Statuses = ("incomplete" | "complete")[] + export type t_TodoList = { created: string id: string diff --git a/integration-tests/typescript-axios/src/generated/todo-lists.yaml/client.ts b/integration-tests/typescript-axios/src/generated/todo-lists.yaml/client.ts index 4633a7ab2..fd4708d27 100644 --- a/integration-tests/typescript-axios/src/generated/todo-lists.yaml/client.ts +++ b/integration-tests/typescript-axios/src/generated/todo-lists.yaml/client.ts @@ -2,7 +2,7 @@ /* tslint:disable */ /* eslint-disable */ -import { t_CreateUpdateTodoList, t_TodoList } from "./models" +import { t_CreateUpdateTodoList, t_Statuses, t_TodoList } from "./models" import { AbstractAxiosClient, AbstractAxiosConfig, @@ -17,13 +17,18 @@ export class ApiClient extends AbstractAxiosClient { async getTodoLists( p: { created?: string - status?: "incomplete" | "complete" + statuses?: t_Statuses + tags?: string[] } = {}, timeout?: number, opts?: AxiosRequestConfig, ): Promise> { const url = `/list` - const query = this._query({ created: p["created"], status: p["status"] }) + const query = this._query({ + created: p["created"], + statuses: p["statuses"], + tags: p["tags"], + }) return this._request({ url: url + query, diff --git a/integration-tests/typescript-axios/src/generated/todo-lists.yaml/models.ts b/integration-tests/typescript-axios/src/generated/todo-lists.yaml/models.ts index 28740557b..ba4801458 100644 --- a/integration-tests/typescript-axios/src/generated/todo-lists.yaml/models.ts +++ b/integration-tests/typescript-axios/src/generated/todo-lists.yaml/models.ts @@ -11,6 +11,8 @@ export type t_CreateUpdateTodoList = { name: string } +export type t_Statuses = ("incomplete" | "complete")[] + export type t_TodoList = { created: string id: string diff --git a/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/client.ts b/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/client.ts index 260b1600c..6b64a8e34 100644 --- a/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/client.ts +++ b/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/client.ts @@ -2,7 +2,12 @@ /* tslint:disable */ /* eslint-disable */ -import { t_CreateUpdateTodoList, t_Error, t_TodoList } from "./models" +import { + t_CreateUpdateTodoList, + t_Error, + t_Statuses, + t_TodoList, +} from "./models" import { AbstractFetchClient, AbstractFetchClientConfig, @@ -23,13 +28,18 @@ export class ApiClient extends AbstractFetchClient { async getTodoLists( p: { created?: string - status?: "incomplete" | "complete" + statuses?: t_Statuses + tags?: string[] } = {}, timeout?: number, opts?: RequestInit, ): Promise>> { const url = this.basePath + `/list` - const query = this._query({ created: p["created"], status: p["status"] }) + const query = this._query({ + created: p["created"], + statuses: p["statuses"], + tags: p["tags"], + }) return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) } diff --git a/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/models.ts b/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/models.ts index 28740557b..ba4801458 100644 --- a/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/models.ts +++ b/integration-tests/typescript-fetch/src/generated/todo-lists.yaml/models.ts @@ -11,6 +11,8 @@ export type t_CreateUpdateTodoList = { name: string } +export type t_Statuses = ("incomplete" | "complete")[] + export type t_TodoList = { created: string id: string diff --git a/integration-tests/typescript-koa/src/generated/api.github.com.yaml/generated.ts b/integration-tests/typescript-koa/src/generated/api.github.com.yaml/generated.ts index f03cc9e9c..eb02dda87 100644 --- a/integration-tests/typescript-koa/src/generated/api.github.com.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/api.github.com.yaml/generated.ts @@ -34473,7 +34473,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const migrationsListForOrgQuerySchema = z.object({ per_page: z.coerce.number().optional(), page: z.coerce.number().optional(), - exclude: z.array(z.enum(["repositories"])).optional(), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), }) const migrationsListForOrgResponseValidator = responseValidationFactory( @@ -34600,7 +34605,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const migrationsGetStatusForOrgQuerySchema = z.object({ - exclude: z.array(z.enum(["repositories"])).optional(), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), }) const migrationsGetStatusForOrgResponseValidator = responseValidationFactory( @@ -36241,7 +36251,12 @@ export function createRouter(implementation: Implementation): KoaRouter { page: z.coerce.number().optional(), sort: z.enum(["created_at"]).optional(), direction: z.enum(["asc", "desc"]).optional(), - owner: z.array(z.string()).max(10).optional(), + owner: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()).max(10), + ) + .optional(), repository: z.string().optional(), permission: z.string().optional(), last_used_before: z.string().datetime({ offset: true }).optional(), @@ -36550,7 +36565,12 @@ export function createRouter(implementation: Implementation): KoaRouter { page: z.coerce.number().optional(), sort: z.enum(["created_at"]).optional(), direction: z.enum(["asc", "desc"]).optional(), - owner: z.array(z.string()).max(10).optional(), + owner: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()).max(10), + ) + .optional(), repository: z.string().optional(), permission: z.string().optional(), last_used_before: z.string().datetime({ offset: true }).optional(), @@ -77622,7 +77642,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const migrationsGetStatusForAuthenticatedUserQuerySchema = z.object({ - exclude: z.array(z.string()).optional(), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), }) const migrationsGetStatusForAuthenticatedUserResponseValidator = diff --git a/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts b/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts index cfe4d3124..4424403db 100644 --- a/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts +++ b/integration-tests/typescript-koa/src/generated/azure-core-data-plane-service.tsp/generated.ts @@ -1040,7 +1040,12 @@ export function createRouter(implementation: Implementation): KoaRouter { top: z.coerce.number().optional(), skip: z.coerce.number().optional(), maxpagesize: z.coerce.number().optional(), - select: z.array(z.string()).optional(), + select: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), }) const widgetsListWidgetsResponseValidator = responseValidationFactory( diff --git a/integration-tests/typescript-koa/src/generated/petstore-expanded.yaml/generated.ts b/integration-tests/typescript-koa/src/generated/petstore-expanded.yaml/generated.ts index e3e0d0e7d..95c8759ac 100644 --- a/integration-tests/typescript-koa/src/generated/petstore-expanded.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/petstore-expanded.yaml/generated.ts @@ -102,7 +102,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const router = new KoaRouter() const findPetsQuerySchema = z.object({ - tags: z.array(z.string()).optional(), + tags: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), limit: z.coerce.number().optional(), }) diff --git a/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts b/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts index a63895685..c3ebb1a3a 100644 --- a/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts @@ -13626,7 +13626,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const router = new KoaRouter() const getAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountBodySchema = z.object({}).optional() @@ -13908,7 +13913,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -14631,7 +14641,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountBodySchema = z.object({}).optional() @@ -15412,7 +15427,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountBankAccountsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountBankAccountsIdBodySchema = z.object({}).optional() @@ -15557,7 +15577,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountCapabilitiesQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountCapabilitiesBodySchema = z.object({}).optional() @@ -15638,7 +15663,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountCapabilitiesCapabilityQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountCapabilitiesCapabilityBodySchema = z @@ -15769,7 +15799,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountExternalAccountsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), object: z.enum(["bank_account", "card"]).optional(), starting_after: z.string().optional(), @@ -16006,7 +16041,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountExternalAccountsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountExternalAccountsIdBodySchema = z.object({}).optional() @@ -16211,7 +16251,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPeopleQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), relationship: z .object({ @@ -16559,7 +16604,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountPeoplePersonQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountPeoplePersonBodySchema = z.object({}).optional() @@ -16820,7 +16870,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPersonsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), relationship: z .object({ @@ -17168,7 +17223,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountPersonsPersonQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountPersonsPersonBodySchema = z.object({}).optional() @@ -17485,7 +17545,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplePayDomainsQuerySchema = z.object({ domain_name: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -17667,7 +17732,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getApplePayDomainsDomainQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getApplePayDomainsDomainBodySchema = z.object({}).optional() @@ -17740,7 +17810,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -17818,7 +17893,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getApplicationFeesFeeRefundsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getApplicationFeesFeeRefundsIdBodySchema = z.object({}).optional() @@ -17938,7 +18018,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesIdParamSchema = z.object({ id: z.string().max(5000) }) const getApplicationFeesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getApplicationFeesIdBodySchema = z.object({}).optional() @@ -18063,7 +18148,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesIdRefundsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -18202,7 +18292,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAppsSecretsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), scope: z.object({ type: z.enum(["account", "user"]), @@ -18383,7 +18478,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getAppsSecretsFindQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), name: z.string().max(5000), scope: z.object({ type: z.enum(["account", "user"]), @@ -18444,7 +18544,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getBalanceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBalanceBodySchema = z.object({}).optional() @@ -18509,7 +18614,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payout: z.string().max(5000).optional(), source: z.string().max(5000).optional(), @@ -18586,7 +18696,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceHistoryIdParamSchema = z.object({ id: z.string().max(5000) }) const getBalanceHistoryIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBalanceHistoryIdBodySchema = z.object({}).optional() @@ -18659,7 +18774,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payout: z.string().max(5000).optional(), source: z.string().max(5000).optional(), @@ -18742,7 +18862,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getBalanceTransactionsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBalanceTransactionsIdBodySchema = z.object({}).optional() @@ -18911,7 +19036,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingMetersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "inactive"]).optional(), @@ -19042,7 +19172,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingMetersIdParamSchema = z.object({ id: z.string().max(5000) }) const getBillingMetersIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBillingMetersIdBodySchema = z.object({}).optional() @@ -19224,7 +19359,12 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000), end_time: z.coerce.number(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), start_time: z.coerce.number(), starting_after: z.string().max(5000).optional(), @@ -19365,7 +19505,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingPortalConfigurationsQuerySchema = z.object({ active: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), is_default: PermissiveBoolean.optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -19582,7 +19727,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getBillingPortalConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBillingPortalConfigurationsConfigurationBodySchema = z @@ -19982,7 +20132,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().optional(), @@ -20169,7 +20324,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getChargesSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -20245,7 +20405,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeParamSchema = z.object({ charge: z.string().max(5000) }) const getChargesChargeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getChargesChargeBodySchema = z.object({}).optional() @@ -20455,7 +20620,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getChargesChargeDisputeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getChargesChargeDisputeBodySchema = z.object({}).optional() @@ -20736,7 +20906,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeRefundsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -20890,7 +21065,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getChargesChargeRefundsRefundQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getChargesChargeRefundsRefundBodySchema = z.object({}).optional() @@ -21022,7 +21202,12 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), customer_details: z.object({ email: z.string() }).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), payment_link: z.string().max(5000).optional(), @@ -22116,7 +22301,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCheckoutSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCheckoutSessionsSessionBodySchema = z.object({}).optional() @@ -22299,7 +22489,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCheckoutSessionsSessionLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22381,7 +22576,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateOrdersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22506,7 +22706,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getClimateOrdersOrderQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getClimateOrdersOrderBodySchema = z.object({}).optional() @@ -22692,7 +22897,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateProductsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22769,7 +22979,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getClimateProductsProductQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getClimateProductsProductBodySchema = z.object({}).optional() @@ -22830,7 +23045,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateSuppliersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22907,7 +23127,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getClimateSuppliersSupplierQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getClimateSuppliersSupplierBodySchema = z.object({}).optional() @@ -22969,7 +23194,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getConfirmationTokensConfirmationTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getConfirmationTokensConfirmationTokenBodySchema = z @@ -23033,7 +23263,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCountrySpecsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -23106,7 +23341,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCountrySpecsCountryQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCountrySpecsCountryBodySchema = z.object({}).optional() @@ -23178,7 +23418,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -23369,7 +23614,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCouponsCouponParamSchema = z.object({ coupon: z.string().max(5000) }) const getCouponsCouponQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCouponsCouponBodySchema = z.object({}).optional() @@ -23499,7 +23749,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice: z.string().max(5000).optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -23668,34 +23923,42 @@ export function createRouter(implementation: Implementation): KoaRouter { credit_amount: z.coerce.number().optional(), effective_at: z.coerce.number().optional(), email_type: z.enum(["credit_note", "none"]).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice: z.string().max(5000), lines: z - .array( - z.object({ - amount: z.coerce.number().optional(), - description: z.string().max(5000).optional(), - invoice_line_item: z.string().max(5000).optional(), - quantity: z.coerce.number().optional(), - tax_amounts: z - .union([ - z.array( - z.object({ - amount: z.coerce.number(), - tax_rate: z.string().max(5000), - taxable_amount: z.coerce.number(), - }), - ), - z.enum([""]), - ]) - .optional(), - tax_rates: z - .union([z.array(z.string().max(5000)), z.enum([""])]) - .optional(), - type: z.enum(["custom_line_item", "invoice_line_item"]), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + invoice_line_item: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate: z.string().max(5000), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + type: z.enum(["custom_line_item", "invoice_line_item"]), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), ) .optional(), memo: z.string().max(5000).optional(), @@ -23774,35 +24037,43 @@ export function createRouter(implementation: Implementation): KoaRouter { effective_at: z.coerce.number().optional(), email_type: z.enum(["credit_note", "none"]).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice: z.string().max(5000), limit: z.coerce.number().optional(), lines: z - .array( - z.object({ - amount: z.coerce.number().optional(), - description: z.string().max(5000).optional(), - invoice_line_item: z.string().max(5000).optional(), - quantity: z.coerce.number().optional(), - tax_amounts: z - .union([ - z.array( - z.object({ - amount: z.coerce.number(), - tax_rate: z.string().max(5000), - taxable_amount: z.coerce.number(), - }), - ), - z.enum([""]), - ]) - .optional(), - tax_rates: z - .union([z.array(z.string().max(5000)), z.enum([""])]) - .optional(), - type: z.enum(["custom_line_item", "invoice_line_item"]), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + invoice_line_item: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate: z.string().max(5000), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + type: z.enum(["custom_line_item", "invoice_line_item"]), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), ) .optional(), memo: z.string().max(5000).optional(), @@ -23897,7 +24168,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCreditNotesCreditNoteLinesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -23977,7 +24253,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCreditNotesIdParamSchema = z.object({ id: z.string().max(5000) }) const getCreditNotesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCreditNotesIdBodySchema = z.object({}).optional() @@ -24240,7 +24521,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), email: z.string().max(512).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), test_clock: z.string().max(5000).optional(), @@ -24529,7 +24815,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -24667,7 +24958,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerBodySchema = z.object({}).optional() @@ -24917,7 +25213,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBalanceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -25069,7 +25370,14 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ customer: z.string().max(5000), transaction: z.string() }) const getCustomersCustomerBalanceTransactionsTransactionQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerBalanceTransactionsTransactionBodySchema = z .object({}) @@ -25217,7 +25525,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBankAccountsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -25468,7 +25781,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerBankAccountsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerBankAccountsIdBodySchema = z.object({}).optional() @@ -25700,7 +26018,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCardsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -25946,7 +26269,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerCardsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerCardsIdBodySchema = z.object({}).optional() @@ -26108,7 +26436,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerCashBalanceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerCashBalanceBodySchema = z.object({}).optional() @@ -26236,7 +26569,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCashBalanceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -26322,7 +26660,14 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ customer: z.string().max(5000), transaction: z.string() }) const getCustomersCustomerCashBalanceTransactionsTransactionQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerCashBalanceTransactionsTransactionBodySchema = z .object({}) @@ -26452,7 +26797,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerDiscountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerDiscountBodySchema = z.object({}).optional() @@ -26590,7 +26940,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerPaymentMethodsQuerySchema = z.object({ allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), type: z @@ -26717,7 +27072,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerPaymentMethodsPaymentMethodBodySchema = z @@ -26786,7 +27146,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSourcesQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), object: z.string().max(5000).optional(), starting_after: z.string().optional(), @@ -27038,7 +27403,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerSourcesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerSourcesIdBodySchema = z.object({}).optional() @@ -27264,7 +27634,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSubscriptionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -27823,7 +28198,14 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z .object({}) @@ -28401,7 +28783,14 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountBodySchema = z.object({}).optional() @@ -28472,7 +28861,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerTaxIdsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -28741,7 +29135,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerTaxIdsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerTaxIdsIdBodySchema = z.object({}).optional() @@ -28812,7 +29211,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -28886,7 +29290,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getDisputesDisputeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getDisputesDisputeBodySchema = z.object({}).optional() @@ -29099,7 +29508,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEntitlementsActiveEntitlementsQuerySchema = z.object({ customer: z.string().max(5000), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -29180,7 +29594,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getEntitlementsActiveEntitlementsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEntitlementsActiveEntitlementsIdBodySchema = z.object({}).optional() @@ -29246,7 +29665,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEntitlementsFeaturesQuerySchema = z.object({ archived: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), lookup_key: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -29380,7 +29804,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getEntitlementsFeaturesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEntitlementsFeaturesIdBodySchema = z.object({}).optional() @@ -29626,11 +30055,21 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), delivery_success: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), type: z.string().max(5000).optional(), - types: z.array(z.string().max(5000)).optional(), + types: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEventsBodySchema = z.object({}).optional() @@ -29699,7 +30138,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEventsIdParamSchema = z.object({ id: z.string().max(5000) }) const getEventsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEventsIdBodySchema = z.object({}).optional() @@ -29756,7 +30200,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getExchangeRatesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -29829,7 +30278,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getExchangeRatesRateIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getExchangeRatesRateIdBodySchema = z.object({}).optional() @@ -29901,7 +30355,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), expired: PermissiveBoolean.optional(), file: z.string().max(5000).optional(), limit: z.coerce.number().optional(), @@ -30023,7 +30482,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFileLinksLinkParamSchema = z.object({ link: z.string() }) const getFileLinksLinkQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFileLinksLinkBodySchema = z.object({}).optional() @@ -30153,7 +30617,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), purpose: z .enum([ @@ -30309,7 +30778,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFilesFileParamSchema = z.object({ file: z.string().max(5000) }) const getFilesFileQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFilesFileBodySchema = z.object({}).optional() @@ -30372,7 +30846,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), session: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -30454,7 +30933,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getFinancialConnectionsAccountsAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFinancialConnectionsAccountsAccountBodySchema = z @@ -30592,7 +31076,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsAccountsAccountOwnersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), ownership: z.string().max(5000), starting_after: z.string().max(5000).optional(), @@ -30956,7 +31445,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getFinancialConnectionsSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFinancialConnectionsSessionsSessionBodySchema = z @@ -31024,7 +31518,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsTransactionsQuerySchema = z.object({ account: z.string().max(5000), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), transacted_at: z @@ -31120,7 +31619,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getFinancialConnectionsTransactionsTransactionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFinancialConnectionsTransactionsTransactionBodySchema = z @@ -31198,7 +31702,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -31343,7 +31852,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getForwardingRequestsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getForwardingRequestsIdBodySchema = z.object({}).optional() @@ -31416,7 +31930,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), type: z.enum(["document", "id_number"]).optional(), @@ -31499,7 +32018,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIdentityVerificationReportsReportQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIdentityVerificationReportsReportBodySchema = z.object({}).optional() @@ -31576,7 +32100,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z @@ -31738,7 +32267,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIdentityVerificationSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIdentityVerificationSessionsSessionBodySchema = z @@ -32027,7 +32561,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice: z.string().max(5000).optional(), limit: z.coerce.number().optional(), pending: PermissiveBoolean.optional(), @@ -32243,7 +32782,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getInvoiceitemsInvoiceitemQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getInvoiceitemsInvoiceitemBodySchema = z.object({}).optional() @@ -32429,7 +32973,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z @@ -33359,7 +33908,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getInvoicesSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -33581,54 +34135,62 @@ export function createRouter(implementation: Implementation): KoaRouter { z.enum([""]), ]) .optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice_items: z - .array( - z.object({ - amount: z.coerce.number().optional(), - currency: z.string().optional(), - description: z.string().max(5000).optional(), - discountable: PermissiveBoolean.optional(), - discounts: z - .union([ - z.array( - z.object({ - coupon: z.string().max(5000).optional(), - discount: z.string().max(5000).optional(), - promotion_code: z.string().max(5000).optional(), - }), - ), - z.enum([""]), - ]) - .optional(), - invoiceitem: z.string().max(5000).optional(), - metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), - period: z - .object({ end: z.coerce.number(), start: z.coerce.number() }) - .optional(), - price: z.string().max(5000).optional(), - price_data: z - .object({ - currency: z.string(), - product: z.string().max(5000), - tax_behavior: z - .enum(["exclusive", "inclusive", "unspecified"]) - .optional(), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }) - .optional(), - quantity: z.coerce.number().optional(), - tax_behavior: z - .enum(["exclusive", "inclusive", "unspecified"]) - .optional(), - tax_code: z.union([z.string(), z.enum([""])]).optional(), - tax_rates: z - .union([z.array(z.string().max(5000)), z.enum([""])]) - .optional(), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + invoiceitem: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.union([z.string(), z.enum([""])]).optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), ) .optional(), issuer: z @@ -33894,48 +34456,51 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), subscription_items: z - .array( - z.object({ - billing_thresholds: z - .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) - .optional(), - clear_usage: PermissiveBoolean.optional(), - deleted: PermissiveBoolean.optional(), - discounts: z - .union([ - z.array( - z.object({ - coupon: z.string().max(5000).optional(), - discount: z.string().max(5000).optional(), - promotion_code: z.string().max(5000).optional(), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + billing_thresholds: z + .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) + .optional(), + clear_usage: PermissiveBoolean.optional(), + deleted: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), }), - ), - z.enum([""]), - ]) - .optional(), - id: z.string().max(5000).optional(), - metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), - price: z.string().max(5000).optional(), - price_data: z - .object({ - currency: z.string(), - product: z.string().max(5000), - recurring: z.object({ - interval: z.enum(["day", "month", "week", "year"]), - interval_count: z.coerce.number().optional(), - }), - tax_behavior: z - .enum(["exclusive", "inclusive", "unspecified"]) - .optional(), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }) - .optional(), - quantity: z.coerce.number().optional(), - tax_rates: z - .union([z.array(z.string().max(5000)), z.enum([""])]) - .optional(), - }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), ) .optional(), subscription_proration_behavior: z @@ -34151,54 +34716,62 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice_items: z - .array( - z.object({ - amount: z.coerce.number().optional(), - currency: z.string().optional(), - description: z.string().max(5000).optional(), - discountable: PermissiveBoolean.optional(), - discounts: z - .union([ - z.array( - z.object({ - coupon: z.string().max(5000).optional(), - discount: z.string().max(5000).optional(), - promotion_code: z.string().max(5000).optional(), - }), - ), - z.enum([""]), - ]) - .optional(), - invoiceitem: z.string().max(5000).optional(), - metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), - period: z - .object({ end: z.coerce.number(), start: z.coerce.number() }) - .optional(), - price: z.string().max(5000).optional(), - price_data: z - .object({ - currency: z.string(), - product: z.string().max(5000), - tax_behavior: z - .enum(["exclusive", "inclusive", "unspecified"]) - .optional(), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }) - .optional(), - quantity: z.coerce.number().optional(), - tax_behavior: z - .enum(["exclusive", "inclusive", "unspecified"]) - .optional(), - tax_code: z.union([z.string(), z.enum([""])]).optional(), - tax_rates: z - .union([z.array(z.string().max(5000)), z.enum([""])]) - .optional(), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + invoiceitem: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.union([z.string(), z.enum([""])]).optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), ) .optional(), issuer: z @@ -34466,48 +35039,51 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), subscription_items: z - .array( - z.object({ - billing_thresholds: z - .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) - .optional(), - clear_usage: PermissiveBoolean.optional(), - deleted: PermissiveBoolean.optional(), - discounts: z - .union([ - z.array( - z.object({ - coupon: z.string().max(5000).optional(), - discount: z.string().max(5000).optional(), - promotion_code: z.string().max(5000).optional(), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + billing_thresholds: z + .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) + .optional(), + clear_usage: PermissiveBoolean.optional(), + deleted: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), }), - ), - z.enum([""]), - ]) - .optional(), - id: z.string().max(5000).optional(), - metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), - price: z.string().max(5000).optional(), - price_data: z - .object({ - currency: z.string(), - product: z.string().max(5000), - recurring: z.object({ - interval: z.enum(["day", "month", "week", "year"]), - interval_count: z.coerce.number().optional(), - }), - tax_behavior: z - .enum(["exclusive", "inclusive", "unspecified"]) - .optional(), - unit_amount: z.coerce.number().optional(), - unit_amount_decimal: z.string().optional(), - }) - .optional(), - quantity: z.coerce.number().optional(), - tax_rates: z - .union([z.array(z.string().max(5000)), z.enum([""])]) - .optional(), - }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), ) .optional(), subscription_proration_behavior: z @@ -34649,7 +35225,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getInvoicesInvoiceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getInvoicesInvoiceBodySchema = z.object({}).optional() @@ -35288,7 +35869,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoicesInvoiceLinesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -35967,7 +36553,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["closed", "pending", "reversed"]).optional(), @@ -36048,7 +36639,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingAuthorizationsAuthorizationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingAuthorizationsAuthorizationBodySchema = z @@ -36311,7 +36907,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), email: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), phone_number: z.string().optional(), starting_after: z.string().max(5000).optional(), @@ -37425,7 +38026,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingCardholdersCardholderQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingCardholdersCardholderBodySchema = z.object({}).optional() @@ -38537,7 +39143,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), exp_month: z.coerce.number().optional(), exp_year: z.coerce.number().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), last4: z.string().max(5000).optional(), limit: z.coerce.number().optional(), personalization_design: z.string().max(5000).optional(), @@ -39628,7 +40239,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingCardsCardQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingCardsCardBodySchema = z.object({}).optional() @@ -40720,7 +41336,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z @@ -41035,7 +41656,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingDisputesDisputeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingDisputesDisputeBodySchema = z.object({}).optional() @@ -41395,9 +42021,19 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPersonalizationDesignsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), - lookup_keys: z.array(z.string().max(200)).optional(), + lookup_keys: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(200)), + ) + .optional(), preferences: z .object({ is_default: PermissiveBoolean.optional(), @@ -41552,7 +42188,14 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ personalization_design: z.string().max(5000) }) const getIssuingPersonalizationDesignsPersonalizationDesignQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getIssuingPersonalizationDesignsPersonalizationDesignBodySchema = z .object({}) @@ -41717,7 +42360,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPhysicalBundlesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "inactive", "review"]).optional(), @@ -41799,7 +42447,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingPhysicalBundlesPhysicalBundleQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingPhysicalBundlesPhysicalBundleBodySchema = z @@ -41866,7 +42519,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingSettlementsSettlementQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingSettlementsSettlementBodySchema = z.object({}).optional() @@ -41996,7 +42654,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "deleted", "requested", "suspended"]).optional(), @@ -42070,7 +42733,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingTokensTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingTokensTokenBodySchema = z.object({}).optional() @@ -42203,7 +42871,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), type: z.enum(["capture", "refund"]).optional(), @@ -42284,7 +42957,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingTransactionsTransactionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingTransactionsTransactionBodySchema = z.object({}).optional() @@ -42489,7 +43167,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getLinkAccountSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getLinkAccountSessionsSessionBodySchema = z.object({}).optional() @@ -42557,7 +43240,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), session: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -42634,7 +43322,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getLinkedAccountsAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getLinkedAccountsAccountBodySchema = z.object({}).optional() @@ -42761,7 +43454,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getLinkedAccountsAccountOwnersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), ownership: z.string().max(5000), starting_after: z.string().max(5000).optional(), @@ -42902,7 +43600,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getMandatesMandateParamSchema = z.object({ mandate: z.string() }) const getMandatesMandateQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getMandatesMandateBodySchema = z.object({}).optional() @@ -42975,7 +43678,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -44055,7 +44763,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getPaymentIntentsSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -44138,7 +44851,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentIntentsIntentQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentIntentsIntentBodySchema = z.object({}).optional() @@ -46541,7 +47259,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentLinksQuerySchema = z.object({ active: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -47144,7 +47867,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentLinksPaymentLinkQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentLinksPaymentLinkBodySchema = z.object({}).optional() @@ -47750,7 +48478,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentLinksPaymentLinkLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -47833,7 +48566,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodConfigurationsQuerySchema = z.object({ application: z.union([z.string().max(100), z.enum([""])]).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -48256,7 +48994,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentMethodConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentMethodConfigurationsConfigurationBodySchema = z @@ -48678,7 +49421,12 @@ export function createRouter(implementation: Implementation): KoaRouter { domain_name: z.string().max(5000).optional(), enabled: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -48810,7 +49558,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentMethodDomainsPaymentMethodDomainQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentMethodDomainsPaymentMethodDomainBodySchema = z @@ -49000,7 +49753,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodsQuerySchema = z.object({ customer: z.string().max(5000).optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), type: z @@ -49443,7 +50201,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentMethodsPaymentMethodQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentMethodsPaymentMethodBodySchema = z.object({}).optional() @@ -49744,7 +50507,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), destination: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.string().max(5000).optional(), @@ -49870,7 +50638,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPayoutsPayoutParamSchema = z.object({ payout: z.string().max(5000) }) const getPayoutsPayoutQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPayoutsPayoutBodySchema = z.object({}).optional() @@ -50115,7 +50888,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), product: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -50328,7 +51106,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPlansPlanParamSchema = z.object({ plan: z.string().max(5000) }) const getPlansPlanQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPlansPlanBodySchema = z.object({}).optional() @@ -50457,9 +51240,19 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), - lookup_keys: z.array(z.string().max(5000)).optional(), + lookup_keys: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), product: z.string().max(5000).optional(), recurring: z .object({ @@ -50668,7 +51461,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPricesSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -50744,7 +51542,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPricesPriceParamSchema = z.object({ price: z.string().max(5000) }) const getPricesPriceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPricesPriceBodySchema = z.object({}).optional() @@ -50908,8 +51711,18 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), - ids: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + ids: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), shippable: PermissiveBoolean.optional(), starting_after: z.string().max(5000).optional(), @@ -51094,7 +51907,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getProductsSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -51220,7 +52038,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsIdParamSchema = z.object({ id: z.string().max(5000) }) const getProductsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getProductsIdBodySchema = z.object({}).optional() @@ -51363,7 +52186,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsProductFeaturesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -51557,7 +52385,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getProductsProductFeaturesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getProductsProductFeaturesIdBodySchema = z.object({}).optional() @@ -51631,7 +52464,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -51771,7 +52609,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPromotionCodesPromotionCodeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPromotionCodesPromotionCodeBodySchema = z.object({}).optional() @@ -51898,7 +52741,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuerySchema = z.object({ customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["accepted", "canceled", "draft", "open"]).optional(), @@ -52145,7 +52993,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteParamSchema = z.object({ quote: z.string().max(5000) }) const getQuotesQuoteQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getQuotesQuoteBodySchema = z.object({}).optional() @@ -52496,7 +53349,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteComputedUpfrontLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -52645,7 +53503,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -52724,7 +53587,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuotePdfParamSchema = z.object({ quote: z.string().max(5000) }) const getQuotesQuotePdfQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getQuotesQuotePdfBodySchema = z.object({}).optional() @@ -52797,7 +53665,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -52878,7 +53751,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRadarEarlyFraudWarningsEarlyFraudWarningBodySchema = z @@ -52953,7 +53831,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), value: z.string().max(800).optional(), @@ -53144,7 +54027,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getRadarValueListItemsItemQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRadarValueListItemsItemBodySchema = z.object({}).optional() @@ -53218,7 +54106,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -53416,7 +54309,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getRadarValueListsValueListQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRadarValueListsValueListBodySchema = z.object({}).optional() @@ -53548,7 +54446,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().optional(), @@ -53681,7 +54584,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRefundsRefundParamSchema = z.object({ refund: z.string() }) const getRefundsRefundQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRefundsRefundBodySchema = z.object({}).optional() @@ -53860,7 +54768,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -54644,7 +55557,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getReportingReportRunsReportRunQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReportingReportRunsReportRunBodySchema = z.object({}).optional() @@ -54702,7 +55620,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getReportingReportTypesQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReportingReportTypesBodySchema = z.object({}).optional() @@ -54777,7 +55700,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getReportingReportTypesReportTypeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReportingReportTypesReportTypeBodySchema = z.object({}).optional() @@ -54850,7 +55778,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -54921,7 +55854,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReviewsReviewParamSchema = z.object({ review: z.string().max(5000) }) const getReviewsReviewQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReviewsReviewBodySchema = z.object({}).optional() @@ -55047,7 +55985,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), setup_intent: z.string().max(5000), starting_after: z.string().max(5000).optional(), @@ -55131,7 +56074,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), payment_method: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -55700,7 +56648,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSetupIntentsIntentQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSetupIntentsIntentBodySchema = z.object({}).optional() @@ -56867,7 +57820,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -57023,7 +57981,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getShippingRatesShippingRateTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getShippingRatesShippingRateTokenBodySchema = z.object({}).optional() @@ -57165,7 +58128,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSigmaScheduledQueryRunsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -57245,7 +58213,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSigmaScheduledQueryRunsScheduledQueryRunBodySchema = z @@ -57461,7 +58434,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSourcesSourceQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSourcesSourceBodySchema = z.object({}).optional() @@ -57663,7 +58641,14 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSourcesSourceMandateNotificationsMandateNotificationQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getSourcesSourceMandateNotificationsMandateNotificationBodySchema = z .object({}) @@ -57735,7 +58720,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSourcesSourceSourceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -57822,7 +58812,14 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSourcesSourceSourceTransactionsSourceTransactionQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getSourcesSourceSourceTransactionsSourceTransactionBodySchema = z .object({}) @@ -57949,7 +58946,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionItemsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), subscription: z.string().max(5000), @@ -58191,7 +59193,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionItemsItemQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSubscriptionItemsItemBodySchema = z.object({}).optional() @@ -58365,7 +59372,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionItemsSubscriptionItemUsageRecordSummariesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -58555,7 +59567,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), released_at: z .union([ @@ -58916,7 +59933,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionSchedulesScheduleQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSubscriptionSchedulesScheduleBodySchema = z.object({}).optional() @@ -59418,7 +60440,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), price: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -59898,7 +60925,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionsSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -60061,7 +61093,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSubscriptionsSubscriptionExposedIdBodySchema = z @@ -60876,7 +61913,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCalculationsCalculationLineItemsQuerySchema = z.object({ ending_before: z.string().max(500).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(500).optional(), }) @@ -60963,7 +62005,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxRegistrationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "all", "expired", "scheduled"]).optional(), @@ -61418,7 +62465,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTaxRegistrationsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxRegistrationsIdBodySchema = z.object({}).optional() @@ -61542,7 +62594,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getTaxSettingsQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxSettingsBodySchema = z.object({}).optional() @@ -61792,7 +62849,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTaxTransactionsTransactionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxTransactionsTransactionBodySchema = z.object({}).optional() @@ -61855,7 +62917,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxTransactionsTransactionLineItemsQuerySchema = z.object({ ending_before: z.string().max(500).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(500).optional(), }) @@ -61942,7 +63009,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCodesQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -62013,7 +63085,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCodesIdParamSchema = z.object({ id: z.string().max(5000) }) const getTaxCodesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxCodesIdBodySchema = z.object({}).optional() @@ -62070,7 +63147,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxIdsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), owner: z .object({ @@ -62327,7 +63409,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxIdsIdParamSchema = z.object({ id: z.string().max(5000) }) const getTaxIdsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxIdsIdBodySchema = z.object({}).optional() @@ -62396,7 +63483,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), inclusive: PermissiveBoolean.optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -62541,7 +63633,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTaxRatesTaxRateQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxRatesTaxRateBodySchema = z.object({}).optional() @@ -62685,7 +63782,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalConfigurationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), is_account_default: PermissiveBoolean.optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -63007,7 +64109,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTerminalConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTerminalConfigurationsConfigurationBodySchema = z @@ -63351,7 +64458,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalLocationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -63546,7 +64658,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTerminalLocationsLocationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTerminalLocationsLocationBodySchema = z.object({}).optional() @@ -63700,7 +64817,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), location: z.string().max(5000).optional(), serial_number: z.string().max(5000).optional(), @@ -63888,7 +65010,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTerminalReadersReaderQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTerminalReadersReaderBodySchema = z.object({}).optional() @@ -67355,7 +68482,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTestHelpersTestClocksQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -67547,7 +68679,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTestHelpersTestClocksTestClockQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTestHelpersTestClocksTestClockBodySchema = z.object({}).optional() @@ -68997,7 +70134,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTokensTokenParamSchema = z.object({ token: z.string().max(5000) }) const getTokensTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTokensTokenBodySchema = z.object({}).optional() @@ -69076,7 +70218,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["canceled", "failed", "pending", "succeeded"]).optional(), @@ -69201,7 +70348,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTopupsTopupParamSchema = z.object({ topup: z.string().max(5000) }) const getTopupsTopupQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTopupsTopupBodySchema = z.object({}).optional() @@ -69384,7 +70536,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), destination: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), transfer_group: z.string().max(5000).optional(), @@ -69513,7 +70670,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTransfersIdReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -69658,7 +70820,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTransfersTransferQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTransfersTransferBodySchema = z.object({}).optional() @@ -69785,7 +70952,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTransfersTransferReversalsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTransfersTransferReversalsIdBodySchema = z.object({}).optional() @@ -69904,7 +71076,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryCreditReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), received_credit: z.string().max(5000).optional(), @@ -70034,7 +71211,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryCreditReversalsCreditReversalQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryCreditReversalsCreditReversalBodySchema = z @@ -70098,7 +71280,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryDebitReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), received_debit: z.string().max(5000).optional(), @@ -70231,7 +71418,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryDebitReversalsDebitReversalQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryDebitReversalsDebitReversalBodySchema = z @@ -70306,7 +71498,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -70480,7 +71677,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryFinancialAccountsFinancialAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryFinancialAccountsFinancialAccountBodySchema = z @@ -70651,7 +71853,14 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ financial_account: z.string().max(5000) }) const getTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getTreasuryFinancialAccountsFinancialAccountFeaturesBodySchema = z .object({}) @@ -70819,7 +72028,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryInboundTransfersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -70956,7 +72170,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryInboundTransfersIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryInboundTransfersIdBodySchema = z.object({}).optional() @@ -71091,7 +72310,12 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -71283,7 +72507,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryOutboundPaymentsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryOutboundPaymentsIdBodySchema = z.object({}).optional() @@ -71401,7 +72630,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryOutboundTransfersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -71550,7 +72784,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryOutboundTransfersOutboundTransferQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryOutboundTransfersOutboundTransferBodySchema = z @@ -71677,7 +72916,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedCreditsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), linked_flows: z @@ -71766,7 +73010,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryReceivedCreditsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryReceivedCreditsIdBodySchema = z.object({}).optional() @@ -71825,7 +73074,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedDebitsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -71904,7 +73158,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryReceivedDebitsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryReceivedDebitsIdBodySchema = z.object({}).optional() @@ -71985,7 +73244,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), order_by: z.enum(["created", "effective_at"]).optional(), @@ -72069,7 +73333,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryTransactionEntriesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryTransactionEntriesIdBodySchema = z.object({}).optional() @@ -72139,7 +73408,12 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), financial_account: z.string(), limit: z.coerce.number().optional(), order_by: z.enum(["created", "posted_at"]).optional(), @@ -72234,7 +73508,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryTransactionsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryTransactionsIdBodySchema = z.object({}).optional() @@ -72295,7 +73574,12 @@ export function createRouter(implementation: Implementation): KoaRouter { const getWebhookEndpointsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -72832,7 +74116,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getWebhookEndpointsWebhookEndpointQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getWebhookEndpointsWebhookEndpointBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-koa/src/generated/todo-lists.yaml/generated.ts b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/generated.ts index 59fda38b4..14694e293 100644 --- a/integration-tests/typescript-koa/src/generated/todo-lists.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/generated.ts @@ -14,7 +14,12 @@ import { t_UpdateTodoListByIdBodySchema, t_UpdateTodoListByIdParamSchema, } from "./models" -import { s_CreateUpdateTodoList, s_Error, s_TodoList } from "./schemas" +import { + s_CreateUpdateTodoList, + s_Error, + s_Statuses, + s_TodoList, +} from "./schemas" import KoaRouter, { RouterContext } from "@koa/router" import { KoaRuntimeError, @@ -167,7 +172,18 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTodoListsQuerySchema = z.object({ created: z.string().datetime({ offset: true }).optional(), - status: z.enum(["incomplete", "complete"]).optional(), + statuses: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + s_Statuses, + ) + .optional(), + tags: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), }) const getTodoListsResponseValidator = responseValidationFactory( diff --git a/integration-tests/typescript-koa/src/generated/todo-lists.yaml/models.ts b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/models.ts index da6dcb289..1422b3d08 100644 --- a/integration-tests/typescript-koa/src/generated/todo-lists.yaml/models.ts +++ b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/models.ts @@ -7,6 +7,8 @@ export type t_Error = { message?: string } +export type t_Statuses = ("incomplete" | "complete")[] + export type t_TodoList = { created: string id: string @@ -40,7 +42,8 @@ export type t_GetTodoListItemsParamSchema = { export type t_GetTodoListsQuerySchema = { created?: string - status?: "incomplete" | "complete" + statuses?: t_Statuses + tags?: string[] } export type t_UpdateTodoListByIdBodySchema = { diff --git a/integration-tests/typescript-koa/src/generated/todo-lists.yaml/schemas.ts b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/schemas.ts index 3c99ec6ce..d1fecbd05 100644 --- a/integration-tests/typescript-koa/src/generated/todo-lists.yaml/schemas.ts +++ b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/schemas.ts @@ -6,6 +6,8 @@ import { z } from "zod" export const s_CreateUpdateTodoList = z.object({ name: z.string() }) +export const s_Statuses = z.array(z.enum(["incomplete", "complete"])) + export const s_TodoList = z.object({ id: z.string(), name: z.string(), diff --git a/integration-tests/typescript-koa/src/petstore-expanded.yaml.ts b/integration-tests/typescript-koa/src/petstore-expanded.yaml.ts index 934c30025..0aa96cb75 100644 --- a/integration-tests/typescript-koa/src/petstore-expanded.yaml.ts +++ b/integration-tests/typescript-koa/src/petstore-expanded.yaml.ts @@ -10,7 +10,7 @@ import {ZodError} from "zod" import {KoaRuntimeResponder} from "@nahkies/typescript-koa-runtime/server" import {t_Error} from "./generated/petstore-expanded.yaml/models" -const notImplemented = async ( +export const notImplemented = async ( _: unknown, respond: KoaRuntimeResponder<501, t_Error>, ) => { diff --git a/integration-tests/typescript-koa/src/todo-lists.yaml.ts b/integration-tests/typescript-koa/src/todo-lists.yaml.ts new file mode 100644 index 000000000..4103c7d8a --- /dev/null +++ b/integration-tests/typescript-koa/src/todo-lists.yaml.ts @@ -0,0 +1,41 @@ +import { + bootstrap, + createRouter, + GetTodoLists, +} from "./generated/todo-lists.yaml/generated" +import {genericErrorMiddleware, notImplemented} from "./petstore-expanded.yaml" +import {t_TodoList} from "./generated/todo-lists.yaml/models" + +const getTodoLists: GetTodoLists = async ({query}, respond)=>{ + console.info('query', {query}) + return respond.with200().body([] as t_TodoList[]) +} + +async function main() { + const {server, address} = await bootstrap({ + router: createRouter({ + getTodoLists, + getTodoListById: notImplemented, + updateTodoListById: notImplemented, + deleteTodoListById: notImplemented, + getTodoListItems: notImplemented, + createTodoListItem: notImplemented, + }), + middleware: [genericErrorMiddleware], + port: {port: 3000, host: "127.0.0.1"}, + }) + + console.info(`listening on http://${address.address}:${address.port}`) + + process.on("SIGTERM", () => { + console.info("sigterm received, closing server") + server.close() + }) +} + +if (require.main === module) { + main().catch((err) => { + console.error("unhandled exception", err) + process.exit(1) + }) +} diff --git a/packages/openapi-code-generator/src/core/input.ts b/packages/openapi-code-generator/src/core/input.ts index 7aadbebec..873c9ff95 100644 --- a/packages/openapi-code-generator/src/core/input.ts +++ b/packages/openapi-code-generator/src/core/input.ts @@ -9,6 +9,7 @@ import type { RequestBody, Responses, Schema, + xInternalPreproccess, } from "./openapi-types" import type { IRModel, @@ -20,6 +21,7 @@ import type { IRModelString, IROperation, IRParameter, + IRPreprocess, IRRef, IRResponse, MaybeIRModel, @@ -195,6 +197,10 @@ export class Input { return normalizeSchemaObject(schema) } + preprocess(maybePreprocess: Reference | xInternalPreproccess): IRPreprocess { + return this.loader.preprocess(maybePreprocess) + } + private normalizeRequestBodyObject( operationId: string, requestBody?: RequestBody | Reference, @@ -368,6 +374,7 @@ function normalizeSchemaObject( const base: IRModelBase = { nullable: schemaObject.nullable || false, readOnly: schemaObject.readOnly || false, + "x-internal-preprocess": schemaObject["x-internal-preprocess"], } switch (schemaObject.type) { diff --git a/packages/openapi-code-generator/src/core/openapi-loader.ts b/packages/openapi-code-generator/src/core/openapi-loader.ts index e8c3c2960..3b2a1c8d9 100644 --- a/packages/openapi-code-generator/src/core/openapi-loader.ts +++ b/packages/openapi-code-generator/src/core/openapi-loader.ts @@ -14,6 +14,7 @@ import type { RequestBody, Response, Schema, + xInternalPreproccess, } from "./openapi-types" import {isRef} from "./openapi-utils" import type {OpenapiValidator} from "./openapi-validator" @@ -73,6 +74,10 @@ export class OpenapiLoader { return isRef(maybeRef) ? this.$ref(maybeRef) : maybeRef } + preprocess(maybeRef: Reference | xInternalPreproccess): xInternalPreproccess { + return isRef(maybeRef) ? this.$ref(maybeRef) : maybeRef + } + private $ref({$ref}: Reference): T { const [key, objPath] = $ref.split("#") diff --git a/packages/openapi-code-generator/src/core/openapi-types-normalized.ts b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts index da549f446..13668ae7c 100644 --- a/packages/openapi-code-generator/src/core/openapi-types-normalized.ts +++ b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts @@ -1,6 +1,8 @@ +import {xInternalPreproccess} from "./openapi-types" import type {HttpMethod} from "./utils" export interface IRRef { + "x-internal-preprocess"?: MaybeIRPreprocess | undefined $ref: string } @@ -8,6 +10,21 @@ export interface IRModelBase { // Note: meaningless for top level objects, maybe we can exclude these somehow in that case nullable: boolean /* false */ readOnly: boolean /* false */ + + "x-internal-preprocess"?: MaybeIRPreprocess | undefined +} + +export type MaybeIRPreprocess = IRPreprocess | IRRef + +export type IRPreprocess = { + serialize?: { + fn: string + type?: string + } + deserialize?: { + fn: string + type?: string + } } export type IRModelNumericFormat = "int32" | "int64" | "float" | "double" diff --git a/packages/openapi-code-generator/src/core/openapi-types.ts b/packages/openapi-code-generator/src/core/openapi-types.ts index bd4cef0ff..a81374db3 100644 --- a/packages/openapi-code-generator/src/core/openapi-types.ts +++ b/packages/openapi-code-generator/src/core/openapi-types.ts @@ -248,6 +248,19 @@ export interface Schema { externalDocs?: ExternalDocumentation | undefined deprecated?: boolean | undefined // xml?: XML | undefined + + "x-internal-preprocess"?: xInternalPreproccess | Reference | undefined +} + +export interface xInternalPreproccess { + serialize?: { + fn: string + type?: string + } + deserialize?: { + fn: string + type?: string + } } export interface Discriminator { @@ -265,6 +278,7 @@ export interface Example { } export interface Reference { + "x-internal-preprocess"?: xInternalPreproccess | Reference | undefined $ref: string } diff --git a/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts b/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts index 4c30f120e..ac33275a6 100644 --- a/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/schema-builders/abstract-schema-builder.ts @@ -163,7 +163,21 @@ export abstract class AbstractSchemaBuilder< if (parameter.required) { model.required.push(parameter.name) } - model.properties[parameter.name] = parameter.schema + + const dereferenced = this.input.loader.schema(parameter.schema) + + if (parameter.in === "query" && dereferenced.type === "array") { + model.properties[parameter.name] = { + ...parameter.schema, + "x-internal-preprocess": { + deserialize: { + fn: "(it: unknown) => Array.isArray(it) || it === undefined ? it : [it]", + }, + }, + } + } else { + model.properties[parameter.name] = parameter.schema + } } return this.fromModel(model, true, true) @@ -192,6 +206,15 @@ export abstract class AbstractSchemaBuilder< result = this.nullable(result) } + if (maybeModel["x-internal-preprocess"]) { + const dereferenced = this.input.loader.preprocess( + maybeModel["x-internal-preprocess"], + ) + if (dereferenced.deserialize) { + result = this.preprocess(result, dereferenced.deserialize.fn) + } + } + result = required ? this.required(result) : this.optional(result) if (this.graph.circular.has(name) && !isAnonymous) { @@ -298,6 +321,15 @@ export abstract class AbstractSchemaBuilder< } } + if (model["x-internal-preprocess"]) { + const dereferenced = this.input.loader.preprocess( + model["x-internal-preprocess"], + ) + if (dereferenced.deserialize) { + result = this.preprocess(result, dereferenced.deserialize.fn) + } + } + if (nullable || model.nullable) { result = this.nullable(result) } @@ -327,6 +359,11 @@ export abstract class AbstractSchemaBuilder< protected abstract union(schemas: string[]): string + protected abstract preprocess( + schema: string, + transformation: string | ((it: unknown) => unknown), + ): string + protected abstract nullable(schema: string): string protected abstract optional(schema: string): string diff --git a/packages/openapi-code-generator/src/typescript/common/schema-builders/joi-schema-builder.ts b/packages/openapi-code-generator/src/typescript/common/schema-builders/joi-schema-builder.ts index 837086ef1..db6c9f4be 100644 --- a/packages/openapi-code-generator/src/typescript/common/schema-builders/joi-schema-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/schema-builders/joi-schema-builder.ts @@ -108,6 +108,26 @@ export class JoiBuilder extends AbstractSchemaBuilder< .join(".") } + protected preprocess( + schema: string, + transformation: string | ((it: unknown) => unknown), + ) { + // TODO: yep this is horrid, but trying to create an extension like: + // joi.extend({type: 'maybeArray', prepare: (it) => ({value: Array.isArray(it) || it === undefined ? it : [it]})}) + // doesn't appear to be chainable, so not sure where else to go, eg: + // > custom.maybeArray().validate([1,2]) + // { value: [ 1, 2 ] } + // > custom.maybeArray().validate(1) + // { value: [ 1 ] } + // > custom.maybeArray().array().items(custom.string()).validate([1,2]) + // Uncaught TypeError: custom.maybeArray(...).array is not a function + return `{ + validate(it: unknown, opts: any) { + const transformation = ${transformation.toString()} + return ${schema}.validate(transformation(it), opts)} + }` + } + protected nullable(schema: string): string { return [schema, "allow(null)"].join(".") } diff --git a/packages/openapi-code-generator/src/typescript/common/schema-builders/zod-schema-builder.ts b/packages/openapi-code-generator/src/typescript/common/schema-builders/zod-schema-builder.ts index 3876b3208..e125c4d58 100644 --- a/packages/openapi-code-generator/src/typescript/common/schema-builders/zod-schema-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/schema-builders/zod-schema-builder.ts @@ -133,6 +133,15 @@ export class ZodBuilder extends AbstractSchemaBuilder< .join(".") } + protected preprocess( + schema: string, + transformation: string | ((it: unknown) => unknown), + ) { + return [zod, `preprocess(${transformation.toString()}, ${schema})`] + .filter(isDefined) + .join(".") + } + protected nullable(schema: string): string { return [schema, "nullable()"].filter(isDefined).join(".") } diff --git a/packages/openapi-code-generator/src/typescript/typescript-koa/typescript-koa.generator.ts b/packages/openapi-code-generator/src/typescript/typescript-koa/typescript-koa.generator.ts index 701a9cb87..ff290fc54 100644 --- a/packages/openapi-code-generator/src/typescript/typescript-koa/typescript-koa.generator.ts +++ b/packages/openapi-code-generator/src/typescript/typescript-koa/typescript-koa.generator.ts @@ -25,14 +25,14 @@ import { function reduceParamsToOpenApiSchema(parameters: IRParameter[]): IRModelObject { return parameters.reduce( - (acc, parameter) => { - acc.properties[parameter.name] = parameter.schema + (model, parameter) => { + model.properties[parameter.name] = parameter.schema if (parameter.required) { - acc.required.push(parameter.name) + model.required.push(parameter.name) } - return acc + return model }, { type: "object",