From ee08fdd7f1e3283cb88e1e11b3bfc4aa9789ba39 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 8 Jun 2024 10:12:01 +0100 Subject: [PATCH 01/10] fix: support array of 1 for query parameter arrays - introduce `x-alpha-transform` concept, allowing for a arbitrary transformation function to be applied to a schema - not yet supported by `joi` - not yet supported by `type-builder` - only really useful for this specific case so far - detect query parameters of an array type, and parse as a `T | T[]`, and then transform to a `T[]` for convenience - does not yet support `$ref`d schemas properly relates #217 --- .../openapi-code-generator/src/core/input.ts | 1 + .../src/core/openapi-types-normalized.ts | 2 ++ .../src/core/openapi-types.ts | 3 ++ .../abstract-schema-builder.ts | 33 ++++++++++++++++++- .../schema-builders/joi-schema-builder.ts | 8 +++++ .../schema-builders/zod-schema-builder.ts | 9 +++++ .../typescript-koa.generator.ts | 8 ++--- 7 files changed, 59 insertions(+), 5 deletions(-) diff --git a/packages/openapi-code-generator/src/core/input.ts b/packages/openapi-code-generator/src/core/input.ts index 7aadbebec..85f1a1a91 100644 --- a/packages/openapi-code-generator/src/core/input.ts +++ b/packages/openapi-code-generator/src/core/input.ts @@ -368,6 +368,7 @@ function normalizeSchemaObject( const base: IRModelBase = { nullable: schemaObject.nullable || false, readOnly: schemaObject.readOnly || false, + "x-alpha-transform": schemaObject["x-alpha-transform"], } switch (schemaObject.type) { 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..b03d264d4 100644 --- a/packages/openapi-code-generator/src/core/openapi-types-normalized.ts +++ b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts @@ -8,6 +8,8 @@ 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-alpha-transform"?: string | undefined } 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..50a69485e 100644 --- a/packages/openapi-code-generator/src/core/openapi-types.ts +++ b/packages/openapi-code-generator/src/core/openapi-types.ts @@ -248,6 +248,9 @@ export interface Schema { externalDocs?: ExternalDocumentation | undefined deprecated?: boolean | undefined // xml?: XML | undefined + + // TODO: not yet supported by type-builder or joi + "x-alpha-transform"?: string | undefined } export interface Discriminator { 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..5cecee512 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,29 @@ export abstract class AbstractSchemaBuilder< if (parameter.required) { model.required.push(parameter.name) } - model.properties[parameter.name] = parameter.schema + + // TODO: support $ref properly + if ( + parameter.in === "query" && + !isRef(parameter.schema) && + parameter.schema.type === "array" + ) { + model.properties[parameter.name] = { + type: "object", + additionalProperties: false, + properties: {}, + readOnly: false, + allOf: [], + nullable: false, + oneOf: [], + required: [], + anyOf: [parameter.schema, parameter.schema.items], + "x-alpha-transform": ((it: unknown) => + Array.isArray(it) || it === undefined ? it : [it]).toString(), + } + } else { + model.properties[parameter.name] = parameter.schema + } } return this.fromModel(model, true, true) @@ -304,6 +326,10 @@ export abstract class AbstractSchemaBuilder< result = required ? this.required(result) : this.optional(result) + if (model["x-alpha-transform"]) { + result = this.transform(result, model["x-alpha-transform"]) + } + return result } @@ -327,6 +353,11 @@ export abstract class AbstractSchemaBuilder< protected abstract union(schemas: string[]): string + protected abstract transform( + 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..eea526797 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,14 @@ export class JoiBuilder extends AbstractSchemaBuilder< .join(".") } + protected transform( + schema: string, + transformation: string | ((it: unknown) => unknown), + ) { + // TODO: is it possible to do arbitrary transformations with `joi`? + return schema + } + 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..7f161c5bf 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 transform( + schema: string, + transformation: string | ((it: unknown) => unknown), + ) { + return [schema, `transform(${transformation.toString()})`] + .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", From db400784de01960a93f51bfd45e62afa1e23709c Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 8 Jun 2024 10:15:36 +0100 Subject: [PATCH 02/10] chore: regenerate --- .../api.github.com.yaml/generated.ts | 25 +- .../generated.ts | 5 +- .../petstore-expanded.yaml/generated.ts | 5 +- .../src/generated/stripe.yaml/generated.ts | 1545 ++++++++++++++--- 4 files changed, 1304 insertions(+), 276 deletions(-) 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..7bdab152d 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,10 @@ 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 + .union([z.array(z.enum(["repositories"])), z.enum(["repositories"])]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const migrationsListForOrgResponseValidator = responseValidationFactory( @@ -34600,7 +34603,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const migrationsGetStatusForOrgQuerySchema = z.object({ - exclude: z.array(z.enum(["repositories"])).optional(), + exclude: z + .union([z.array(z.enum(["repositories"])), z.enum(["repositories"])]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const migrationsGetStatusForOrgResponseValidator = responseValidationFactory( @@ -36241,7 +36247,10 @@ 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 + .union([z.array(z.string()).max(10), z.string()]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), repository: z.string().optional(), permission: z.string().optional(), last_used_before: z.string().datetime({ offset: true }).optional(), @@ -36550,7 +36559,10 @@ 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 + .union([z.array(z.string()).max(10), z.string()]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), repository: z.string().optional(), permission: z.string().optional(), last_used_before: z.string().datetime({ offset: true }).optional(), @@ -77622,7 +77634,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const migrationsGetStatusForAuthenticatedUserQuerySchema = z.object({ - exclude: z.array(z.string()).optional(), + exclude: z + .union([z.array(z.string()), z.string()]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) 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..11a4923b4 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,10 @@ 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 + .union([z.array(z.string()), z.string()]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) 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..56e9014fc 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,10 @@ export function createRouter(implementation: Implementation): KoaRouter { const router = new KoaRouter() const findPetsQuerySchema = z.object({ - tags: z.array(z.string()).optional(), + tags: z + .union([z.array(z.string()), z.string()]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), 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..6f4895e98 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,10 @@ export function createRouter(implementation: Implementation): KoaRouter { const router = new KoaRouter() const getAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountBodySchema = z.object({}).optional() @@ -13908,7 +13911,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -14631,7 +14637,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountBodySchema = z.object({}).optional() @@ -15412,7 +15421,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountBankAccountsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountBankAccountsIdBodySchema = z.object({}).optional() @@ -15557,7 +15569,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountCapabilitiesQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountCapabilitiesBodySchema = z.object({}).optional() @@ -15638,7 +15653,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountCapabilitiesCapabilityQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountCapabilitiesCapabilityBodySchema = z @@ -15769,7 +15787,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), object: z.enum(["bank_account", "card"]).optional(), starting_after: z.string().optional(), @@ -16006,7 +16027,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountExternalAccountsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountExternalAccountsIdBodySchema = z.object({}).optional() @@ -16211,7 +16235,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), relationship: z .object({ @@ -16559,7 +16586,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountPeoplePersonQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountPeoplePersonBodySchema = z.object({}).optional() @@ -16820,7 +16850,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), relationship: z .object({ @@ -17168,7 +17201,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getAccountsAccountPersonsPersonQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getAccountsAccountPersonsPersonBodySchema = z.object({}).optional() @@ -17485,7 +17521,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -17667,7 +17706,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getApplePayDomainsDomainQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getApplePayDomainsDomainBodySchema = z.object({}).optional() @@ -17740,7 +17782,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -17818,7 +17863,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getApplicationFeesFeeRefundsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getApplicationFeesFeeRefundsIdBodySchema = z.object({}).optional() @@ -17938,7 +17986,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getApplicationFeesIdBodySchema = z.object({}).optional() @@ -18063,7 +18114,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -18202,7 +18256,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), scope: z.object({ type: z.enum(["account", "user"]), @@ -18383,7 +18440,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getAppsSecretsFindQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), name: z.string().max(5000), scope: z.object({ type: z.enum(["account", "user"]), @@ -18444,7 +18504,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getBalanceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getBalanceBodySchema = z.object({}).optional() @@ -18509,7 +18572,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payout: z.string().max(5000).optional(), source: z.string().max(5000).optional(), @@ -18586,7 +18652,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getBalanceHistoryIdBodySchema = z.object({}).optional() @@ -18659,7 +18728,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payout: z.string().max(5000).optional(), source: z.string().max(5000).optional(), @@ -18742,7 +18814,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getBalanceTransactionsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getBalanceTransactionsIdBodySchema = z.object({}).optional() @@ -18911,7 +18986,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "inactive"]).optional(), @@ -19042,7 +19120,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getBillingMetersIdBodySchema = z.object({}).optional() @@ -19224,7 +19305,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), start_time: z.coerce.number(), starting_after: z.string().max(5000).optional(), @@ -19365,7 +19449,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), is_default: PermissiveBoolean.optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -19582,7 +19669,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getBillingPortalConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getBillingPortalConfigurationsConfigurationBodySchema = z @@ -19982,7 +20072,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().optional(), @@ -20169,7 +20262,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getChargesSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -20245,7 +20341,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getChargesChargeBodySchema = z.object({}).optional() @@ -20455,7 +20554,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getChargesChargeDisputeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getChargesChargeDisputeBodySchema = z.object({}).optional() @@ -20736,7 +20838,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -20890,7 +20995,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getChargesChargeRefundsRefundQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getChargesChargeRefundsRefundBodySchema = z.object({}).optional() @@ -21022,7 +21130,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), payment_link: z.string().max(5000).optional(), @@ -22116,7 +22227,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCheckoutSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCheckoutSessionsSessionBodySchema = z.object({}).optional() @@ -22299,7 +22413,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22381,7 +22498,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22506,7 +22626,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getClimateOrdersOrderQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getClimateOrdersOrderBodySchema = z.object({}).optional() @@ -22692,7 +22815,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22769,7 +22895,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getClimateProductsProductQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getClimateProductsProductBodySchema = z.object({}).optional() @@ -22830,7 +22959,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -22907,7 +23039,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getClimateSuppliersSupplierQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getClimateSuppliersSupplierBodySchema = z.object({}).optional() @@ -22969,7 +23104,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getConfirmationTokensConfirmationTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getConfirmationTokensConfirmationTokenBodySchema = z @@ -23033,7 +23171,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -23106,7 +23247,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCountrySpecsCountryQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCountrySpecsCountryBodySchema = z.object({}).optional() @@ -23178,7 +23322,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -23369,7 +23516,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCouponsCouponBodySchema = z.object({}).optional() @@ -23499,7 +23649,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), invoice: z.string().max(5000).optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -23668,10 +23821,39 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), invoice: z.string().max(5000), lines: z - .array( + .union([ + 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(), + }), + ), z.object({ amount: z.coerce.number().optional(), description: z.string().max(5000).optional(), @@ -23696,8 +23878,9 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount: z.coerce.number().optional(), unit_amount_decimal: z.string().optional(), }), - ) - .optional(), + ]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), memo: z.string().max(5000).optional(), metadata: z.record(z.string()).optional(), out_of_band_amount: z.coerce.number().optional(), @@ -23774,11 +23957,40 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), invoice: z.string().max(5000), limit: z.coerce.number().optional(), lines: z - .array( + .union([ + 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(), + }), + ), z.object({ amount: z.coerce.number().optional(), description: z.string().max(5000).optional(), @@ -23803,8 +24015,9 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount: z.coerce.number().optional(), unit_amount_decimal: z.string().optional(), }), - ) - .optional(), + ]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), memo: z.string().max(5000).optional(), metadata: z.record(z.string()).optional(), out_of_band_amount: z.coerce.number().optional(), @@ -23897,7 +24110,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -23977,7 +24193,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCreditNotesIdBodySchema = z.object({}).optional() @@ -24240,7 +24459,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), test_clock: z.string().max(5000).optional(), @@ -24529,7 +24751,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -24667,7 +24892,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerBodySchema = z.object({}).optional() @@ -24917,7 +25145,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -25069,7 +25300,12 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getCustomersCustomerBalanceTransactionsTransactionBodySchema = z .object({}) @@ -25217,7 +25453,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -25468,7 +25707,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerBankAccountsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerBankAccountsIdBodySchema = z.object({}).optional() @@ -25700,7 +25942,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -25946,7 +26191,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerCardsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerCardsIdBodySchema = z.object({}).optional() @@ -26108,7 +26356,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerCashBalanceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerCashBalanceBodySchema = z.object({}).optional() @@ -26236,7 +26487,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -26322,7 +26576,12 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getCustomersCustomerCashBalanceTransactionsTransactionBodySchema = z .object({}) @@ -26452,7 +26711,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerDiscountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerDiscountBodySchema = z.object({}).optional() @@ -26590,7 +26852,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), type: z @@ -26717,7 +26982,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerPaymentMethodsPaymentMethodBodySchema = z @@ -26786,7 +27054,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), object: z.string().max(5000).optional(), starting_after: z.string().optional(), @@ -27038,7 +27309,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerSourcesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerSourcesIdBodySchema = z.object({}).optional() @@ -27264,7 +27538,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -27823,7 +28100,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z .object({}) @@ -28401,7 +28683,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountBodySchema = z.object({}).optional() @@ -28472,7 +28759,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -28741,7 +29031,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getCustomersCustomerTaxIdsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getCustomersCustomerTaxIdsIdBodySchema = z.object({}).optional() @@ -28812,7 +29105,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -28886,7 +29182,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getDisputesDisputeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getDisputesDisputeBodySchema = z.object({}).optional() @@ -29099,7 +29398,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -29180,7 +29482,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getEntitlementsActiveEntitlementsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getEntitlementsActiveEntitlementsIdBodySchema = z.object({}).optional() @@ -29246,7 +29551,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), lookup_key: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -29380,7 +29688,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getEntitlementsFeaturesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getEntitlementsFeaturesIdBodySchema = z.object({}).optional() @@ -29626,11 +29937,17 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getEventsBodySchema = z.object({}).optional() @@ -29699,7 +30016,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getEventsIdBodySchema = z.object({}).optional() @@ -29756,7 +30076,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -29829,7 +30152,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getExchangeRatesRateIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getExchangeRatesRateIdBodySchema = z.object({}).optional() @@ -29901,7 +30227,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), expired: PermissiveBoolean.optional(), file: z.string().max(5000).optional(), limit: z.coerce.number().optional(), @@ -30023,7 +30352,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getFileLinksLinkBodySchema = z.object({}).optional() @@ -30153,7 +30485,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), purpose: z .enum([ @@ -30309,7 +30644,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getFilesFileBodySchema = z.object({}).optional() @@ -30372,7 +30710,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), session: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -30454,7 +30795,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getFinancialConnectionsAccountsAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getFinancialConnectionsAccountsAccountBodySchema = z @@ -30592,7 +30936,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), ownership: z.string().max(5000), starting_after: z.string().max(5000).optional(), @@ -30956,7 +31303,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getFinancialConnectionsSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getFinancialConnectionsSessionsSessionBodySchema = z @@ -31024,7 +31374,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), transacted_at: z @@ -31120,7 +31473,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getFinancialConnectionsTransactionsTransactionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getFinancialConnectionsTransactionsTransactionBodySchema = z @@ -31198,7 +31554,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -31343,7 +31702,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getForwardingRequestsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getForwardingRequestsIdBodySchema = z.object({}).optional() @@ -31416,7 +31778,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), type: z.enum(["document", "id_number"]).optional(), @@ -31499,7 +31864,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIdentityVerificationReportsReportQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIdentityVerificationReportsReportBodySchema = z.object({}).optional() @@ -31576,7 +31944,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z @@ -31738,7 +32109,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIdentityVerificationSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIdentityVerificationSessionsSessionBodySchema = z @@ -32027,7 +32401,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), invoice: z.string().max(5000).optional(), limit: z.coerce.number().optional(), pending: PermissiveBoolean.optional(), @@ -32243,7 +32620,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getInvoiceitemsInvoiceitemQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getInvoiceitemsInvoiceitemBodySchema = z.object({}).optional() @@ -32429,7 +32809,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z @@ -33359,7 +33742,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getInvoicesSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -33581,9 +33967,59 @@ export function createRouter(implementation: Implementation): KoaRouter { z.enum([""]), ]) .optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), invoice_items: z - .array( + .union([ + 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(), + }), + ), z.object({ amount: z.coerce.number().optional(), currency: z.string().optional(), @@ -33629,8 +34065,9 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount: z.coerce.number().optional(), unit_amount_decimal: z.string().optional(), }), - ) - .optional(), + ]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), issuer: z .object({ account: z.string().optional(), @@ -33894,7 +34331,50 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), subscription_items: z - .array( + .union([ + 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(), + }), + 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(), + }), + ), z.object({ billing_thresholds: z .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) @@ -33936,8 +34416,9 @@ export function createRouter(implementation: Implementation): KoaRouter { .union([z.array(z.string().max(5000)), z.enum([""])]) .optional(), }), - ) - .optional(), + ]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), subscription_proration_behavior: z .enum(["always_invoice", "create_prorations", "none"]) .optional(), @@ -34151,9 +34632,59 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), invoice_items: z - .array( + .union([ + 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(), + }), + ), z.object({ amount: z.coerce.number().optional(), currency: z.string().optional(), @@ -34199,8 +34730,9 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount: z.coerce.number().optional(), unit_amount_decimal: z.string().optional(), }), - ) - .optional(), + ]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), issuer: z .object({ account: z.string().optional(), @@ -34466,7 +34998,50 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), subscription_items: z - .array( + .union([ + 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(), + }), + 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(), + }), + ), z.object({ billing_thresholds: z .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) @@ -34508,8 +35083,9 @@ export function createRouter(implementation: Implementation): KoaRouter { .union([z.array(z.string().max(5000)), z.enum([""])]) .optional(), }), - ) - .optional(), + ]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), subscription_proration_behavior: z .enum(["always_invoice", "create_prorations", "none"]) .optional(), @@ -34649,7 +35225,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getInvoicesInvoiceQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getInvoicesInvoiceBodySchema = z.object({}).optional() @@ -35288,7 +35867,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -35967,7 +36549,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["closed", "pending", "reversed"]).optional(), @@ -36048,7 +36633,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingAuthorizationsAuthorizationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingAuthorizationsAuthorizationBodySchema = z @@ -36311,7 +36899,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), phone_number: z.string().optional(), starting_after: z.string().max(5000).optional(), @@ -37425,7 +38016,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingCardholdersCardholderQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingCardholdersCardholderBodySchema = z.object({}).optional() @@ -38537,7 +39131,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), last4: z.string().max(5000).optional(), limit: z.coerce.number().optional(), personalization_design: z.string().max(5000).optional(), @@ -39628,7 +40225,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingCardsCardQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingCardsCardBodySchema = z.object({}).optional() @@ -40720,7 +41320,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z @@ -41035,7 +41638,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingDisputesDisputeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingDisputesDisputeBodySchema = z.object({}).optional() @@ -41395,9 +42001,15 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), - lookup_keys: z.array(z.string().max(200)).optional(), + lookup_keys: z + .union([z.array(z.string().max(200)), z.string().max(200)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), preferences: z .object({ is_default: PermissiveBoolean.optional(), @@ -41552,7 +42164,12 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getIssuingPersonalizationDesignsPersonalizationDesignBodySchema = z .object({}) @@ -41717,7 +42334,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "inactive", "review"]).optional(), @@ -41799,7 +42419,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingPhysicalBundlesPhysicalBundleQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingPhysicalBundlesPhysicalBundleBodySchema = z @@ -41866,7 +42489,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingSettlementsSettlementQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingSettlementsSettlementBodySchema = z.object({}).optional() @@ -41996,7 +42622,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "deleted", "requested", "suspended"]).optional(), @@ -42070,7 +42699,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingTokensTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingTokensTokenBodySchema = z.object({}).optional() @@ -42203,7 +42835,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), type: z.enum(["capture", "refund"]).optional(), @@ -42284,7 +42919,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getIssuingTransactionsTransactionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getIssuingTransactionsTransactionBodySchema = z.object({}).optional() @@ -42489,7 +43127,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getLinkAccountSessionsSessionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getLinkAccountSessionsSessionBodySchema = z.object({}).optional() @@ -42557,7 +43198,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), session: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -42634,7 +43278,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getLinkedAccountsAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getLinkedAccountsAccountBodySchema = z.object({}).optional() @@ -42761,7 +43408,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), ownership: z.string().max(5000), starting_after: z.string().max(5000).optional(), @@ -42902,7 +43552,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getMandatesMandateBodySchema = z.object({}).optional() @@ -42975,7 +43628,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -44055,7 +44711,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getPaymentIntentsSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -44138,7 +44797,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPaymentIntentsIntentBodySchema = z.object({}).optional() @@ -46541,7 +47203,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -47144,7 +47809,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentLinksPaymentLinkQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPaymentLinksPaymentLinkBodySchema = z.object({}).optional() @@ -47750,7 +48418,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -47833,7 +48504,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -48256,7 +48930,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentMethodConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPaymentMethodConfigurationsConfigurationBodySchema = z @@ -48678,7 +49355,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -48810,7 +49490,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentMethodDomainsPaymentMethodDomainQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPaymentMethodDomainsPaymentMethodDomainBodySchema = z @@ -49000,7 +49683,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), type: z @@ -49443,7 +50129,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPaymentMethodsPaymentMethodQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPaymentMethodsPaymentMethodBodySchema = z.object({}).optional() @@ -49744,7 +50433,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.string().max(5000).optional(), @@ -49870,7 +50562,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPayoutsPayoutBodySchema = z.object({}).optional() @@ -50115,7 +50810,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), product: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -50328,7 +51026,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPlansPlanBodySchema = z.object({}).optional() @@ -50457,9 +51158,15 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), - lookup_keys: z.array(z.string().max(5000)).optional(), + lookup_keys: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), product: z.string().max(5000).optional(), recurring: z .object({ @@ -50668,7 +51375,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPricesSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -50744,7 +51454,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPricesPriceBodySchema = z.object({}).optional() @@ -50908,8 +51621,14 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ids: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), shippable: PermissiveBoolean.optional(), starting_after: z.string().max(5000).optional(), @@ -51094,7 +51813,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getProductsSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -51220,7 +51942,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getProductsIdBodySchema = z.object({}).optional() @@ -51363,7 +52088,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -51557,7 +52285,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getProductsProductFeaturesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getProductsProductFeaturesIdBodySchema = z.object({}).optional() @@ -51631,7 +52362,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -51771,7 +52505,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getPromotionCodesPromotionCodeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getPromotionCodesPromotionCodeBodySchema = z.object({}).optional() @@ -51898,7 +52635,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["accepted", "canceled", "draft", "open"]).optional(), @@ -52145,7 +52885,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getQuotesQuoteBodySchema = z.object({}).optional() @@ -52496,7 +53239,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -52645,7 +53391,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -52724,7 +53473,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getQuotesQuotePdfBodySchema = z.object({}).optional() @@ -52797,7 +53549,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -52878,7 +53633,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getRadarEarlyFraudWarningsEarlyFraudWarningBodySchema = z @@ -52953,7 +53711,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), value: z.string().max(800).optional(), @@ -53144,7 +53905,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getRadarValueListItemsItemQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getRadarValueListItemsItemBodySchema = z.object({}).optional() @@ -53218,7 +53982,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -53416,7 +54183,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getRadarValueListsValueListQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getRadarValueListsValueListBodySchema = z.object({}).optional() @@ -53548,7 +54318,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payment_intent: z.string().max(5000).optional(), starting_after: z.string().optional(), @@ -53681,7 +54454,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getRefundsRefundBodySchema = z.object({}).optional() @@ -53860,7 +54636,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -54644,7 +55423,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getReportingReportRunsReportRunQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getReportingReportRunsReportRunBodySchema = z.object({}).optional() @@ -54702,7 +55484,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getReportingReportTypesQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getReportingReportTypesBodySchema = z.object({}).optional() @@ -54777,7 +55562,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getReportingReportTypesReportTypeQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getReportingReportTypesReportTypeBodySchema = z.object({}).optional() @@ -54850,7 +55638,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -54921,7 +55712,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getReviewsReviewBodySchema = z.object({}).optional() @@ -55047,7 +55841,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), setup_intent: z.string().max(5000), starting_after: z.string().max(5000).optional(), @@ -55131,7 +55928,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), payment_method: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -55700,7 +56500,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getSetupIntentsIntentBodySchema = z.object({}).optional() @@ -56867,7 +57670,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -57023,7 +57829,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getShippingRatesShippingRateTokenQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getShippingRatesShippingRateTokenBodySchema = z.object({}).optional() @@ -57165,7 +57974,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -57245,7 +58057,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getSigmaScheduledQueryRunsScheduledQueryRunBodySchema = z @@ -57461,7 +58276,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getSourcesSourceBodySchema = z.object({}).optional() @@ -57663,7 +58481,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSourcesSourceMandateNotificationsMandateNotificationQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getSourcesSourceMandateNotificationsMandateNotificationBodySchema = z .object({}) @@ -57735,7 +58558,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -57822,7 +58648,12 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSourcesSourceSourceTransactionsSourceTransactionQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getSourcesSourceSourceTransactionsSourceTransactionBodySchema = z .object({}) @@ -57949,7 +58780,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), subscription: z.string().max(5000), @@ -58191,7 +59025,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionItemsItemQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getSubscriptionItemsItemBodySchema = z.object({}).optional() @@ -58365,7 +59202,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -58555,7 +59395,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), released_at: z .union([ @@ -58916,7 +59759,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionSchedulesScheduleQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getSubscriptionSchedulesScheduleBodySchema = z.object({}).optional() @@ -59418,7 +60264,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), price: z.string().max(5000).optional(), starting_after: z.string().max(5000).optional(), @@ -59898,7 +60747,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionsSearchQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), page: z.string().max(5000).optional(), query: z.string().max(5000), @@ -60061,7 +60913,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getSubscriptionsSubscriptionExposedIdBodySchema = z @@ -60876,7 +61731,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(500).optional(), }) @@ -60963,7 +61821,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["active", "all", "expired", "scheduled"]).optional(), @@ -61418,7 +62279,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTaxRegistrationsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTaxRegistrationsIdBodySchema = z.object({}).optional() @@ -61542,7 +62406,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ) const getTaxSettingsQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTaxSettingsBodySchema = z.object({}).optional() @@ -61792,7 +62659,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTaxTransactionsTransactionQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTaxTransactionsTransactionBodySchema = z.object({}).optional() @@ -61855,7 +62725,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(500).optional(), }) @@ -61942,7 +62815,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -62013,7 +62889,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTaxCodesIdBodySchema = z.object({}).optional() @@ -62070,7 +62949,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), owner: z .object({ @@ -62327,7 +63209,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTaxIdsIdBodySchema = z.object({}).optional() @@ -62396,7 +63281,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), inclusive: PermissiveBoolean.optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -62541,7 +63429,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTaxRatesTaxRateQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTaxRatesTaxRateBodySchema = z.object({}).optional() @@ -62685,7 +63576,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), is_account_default: PermissiveBoolean.optional(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -63007,7 +63901,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTerminalConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTerminalConfigurationsConfigurationBodySchema = z @@ -63351,7 +64248,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -63546,7 +64446,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTerminalLocationsLocationQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTerminalLocationsLocationBodySchema = z.object({}).optional() @@ -63700,7 +64603,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), location: z.string().max(5000).optional(), serial_number: z.string().max(5000).optional(), @@ -63888,7 +64794,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTerminalReadersReaderQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTerminalReadersReaderBodySchema = z.object({}).optional() @@ -67355,7 +68264,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -67547,7 +68459,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTestHelpersTestClocksTestClockQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTestHelpersTestClocksTestClockBodySchema = z.object({}).optional() @@ -68997,7 +69912,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTokensTokenBodySchema = z.object({}).optional() @@ -69076,7 +69994,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), status: z.enum(["canceled", "failed", "pending", "succeeded"]).optional(), @@ -69201,7 +70122,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTopupsTopupBodySchema = z.object({}).optional() @@ -69384,7 +70308,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), transfer_group: z.string().max(5000).optional(), @@ -69513,7 +70440,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -69658,7 +70588,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTransfersTransferQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTransfersTransferBodySchema = z.object({}).optional() @@ -69785,7 +70718,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTransfersTransferReversalsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTransfersTransferReversalsIdBodySchema = z.object({}).optional() @@ -69904,7 +70840,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), received_credit: z.string().max(5000).optional(), @@ -70034,7 +70973,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryCreditReversalsCreditReversalQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryCreditReversalsCreditReversalBodySchema = z @@ -70098,7 +71040,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), received_debit: z.string().max(5000).optional(), @@ -70231,7 +71176,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryDebitReversalsDebitReversalQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryDebitReversalsDebitReversalBodySchema = z @@ -70306,7 +71254,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -70480,7 +71431,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryFinancialAccountsFinancialAccountQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryFinancialAccountsFinancialAccountBodySchema = z @@ -70651,7 +71605,12 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + }) const getTreasuryFinancialAccountsFinancialAccountFeaturesBodySchema = z .object({}) @@ -70819,7 +71778,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -70956,7 +71918,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryInboundTransfersIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryInboundTransfersIdBodySchema = z.object({}).optional() @@ -71091,7 +72056,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -71283,7 +72251,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryOutboundPaymentsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryOutboundPaymentsIdBodySchema = z.object({}).optional() @@ -71401,7 +72372,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -71550,7 +72524,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryOutboundTransfersOutboundTransferQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryOutboundTransfersOutboundTransferBodySchema = z @@ -71677,7 +72654,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), linked_flows: z @@ -71766,7 +72746,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryReceivedCreditsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryReceivedCreditsIdBodySchema = z.object({}).optional() @@ -71825,7 +72808,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), @@ -71904,7 +72890,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryReceivedDebitsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryReceivedDebitsIdBodySchema = z.object({}).optional() @@ -71985,7 +72974,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), order_by: z.enum(["created", "effective_at"]).optional(), @@ -72069,7 +73061,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryTransactionEntriesIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryTransactionEntriesIdBodySchema = z.object({}).optional() @@ -72139,7 +73134,10 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), financial_account: z.string(), limit: z.coerce.number().optional(), order_by: z.enum(["created", "posted_at"]).optional(), @@ -72234,7 +73232,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getTreasuryTransactionsIdQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getTreasuryTransactionsIdBodySchema = z.object({}).optional() @@ -72295,7 +73296,10 @@ 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 + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), limit: z.coerce.number().optional(), starting_after: z.string().max(5000).optional(), }) @@ -72832,7 +73836,10 @@ export function createRouter(implementation: Implementation): KoaRouter { }) const getWebhookEndpointsWebhookEndpointQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + expand: z + .union([z.array(z.string().max(5000)), z.string().max(5000)]) + .optional() + .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), }) const getWebhookEndpointsWebhookEndpointBodySchema = z.object({}).optional() From 723037dd9c57a6452e21ef30cd0a541dce853a24 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 8 Jun 2024 12:08:45 +0100 Subject: [PATCH 03/10] feat: extend to support type-builder --- integration-tests-definitions/todo-lists.yaml | 3 +++ .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/schemas.ts | 5 ++++- .../src/core/openapi-types-normalized.ts | 7 ++++++- .../openapi-code-generator/src/core/openapi-types.ts | 9 +++++++-- .../common/schema-builders/abstract-schema-builder.ts | 10 ++++++---- .../src/typescript/common/type-builder.ts | 4 +++- 10 files changed, 33 insertions(+), 13 deletions(-) diff --git a/integration-tests-definitions/todo-lists.yaml b/integration-tests-definitions/todo-lists.yaml index d58aa57a5..2ef159672 100644 --- a/integration-tests-definitions/todo-lists.yaml +++ b/integration-tests-definitions/todo-lists.yaml @@ -171,6 +171,9 @@ components: created: type: string format: date-time + x-alpha-transform: + fn: (it) => new Date(it) + type: Date updated: type: string format: date-time 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..6633a8fe6 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 @@ -12,7 +12,7 @@ export type t_CreateUpdateTodoList = { } export type t_TodoList = { - created: string + created: Date id: string incompleteItemCount: number name: string 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..6633a8fe6 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 @@ -12,7 +12,7 @@ export type t_CreateUpdateTodoList = { } export type t_TodoList = { - created: string + created: Date id: string incompleteItemCount: number name: string 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..6633a8fe6 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 @@ -12,7 +12,7 @@ export type t_CreateUpdateTodoList = { } export type t_TodoList = { - created: string + created: Date id: string incompleteItemCount: number name: string 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..693c813d7 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 @@ -8,7 +8,7 @@ export type t_Error = { } export type t_TodoList = { - created: string + created: Date id: string incompleteItemCount: number name: string 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..b276b1a7d 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 @@ -11,7 +11,10 @@ export const s_TodoList = z.object({ name: z.string(), totalItemCount: z.coerce.number(), incompleteItemCount: z.coerce.number(), - created: z.string().datetime({ offset: true }), + created: z + .string() + .datetime({ offset: true }) + .transform((it) => new Date(it)), updated: z.string().datetime({ offset: true }), }) 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 b03d264d4..f583423c0 100644 --- a/packages/openapi-code-generator/src/core/openapi-types-normalized.ts +++ b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts @@ -9,7 +9,12 @@ export interface IRModelBase { nullable: boolean /* false */ readOnly: boolean /* false */ - "x-alpha-transform"?: string | undefined + "x-alpha-transform"?: + | { + fn?: string | undefined + type?: string | undefined + } + | undefined } 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 50a69485e..4f9ad16b8 100644 --- a/packages/openapi-code-generator/src/core/openapi-types.ts +++ b/packages/openapi-code-generator/src/core/openapi-types.ts @@ -249,8 +249,13 @@ export interface Schema { deprecated?: boolean | undefined // xml?: XML | undefined - // TODO: not yet supported by type-builder or joi - "x-alpha-transform"?: string | undefined + // TODO: not yet supported by joi + "x-alpha-transform"?: + | { + fn?: string | undefined + type?: string | undefined + } + | undefined } export interface Discriminator { 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 5cecee512..2459e8fed 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 @@ -180,8 +180,10 @@ export abstract class AbstractSchemaBuilder< oneOf: [], required: [], anyOf: [parameter.schema, parameter.schema.items], - "x-alpha-transform": ((it: unknown) => - Array.isArray(it) || it === undefined ? it : [it]).toString(), + "x-alpha-transform": { + fn: ((it: unknown) => + Array.isArray(it) || it === undefined ? it : [it]).toString(), + }, } } else { model.properties[parameter.name] = parameter.schema @@ -326,8 +328,8 @@ export abstract class AbstractSchemaBuilder< result = required ? this.required(result) : this.optional(result) - if (model["x-alpha-transform"]) { - result = this.transform(result, model["x-alpha-transform"]) + if (model["x-alpha-transform"]?.fn) { + result = this.transform(result, model["x-alpha-transform"]?.fn) } return result diff --git a/packages/openapi-code-generator/src/typescript/common/type-builder.ts b/packages/openapi-code-generator/src/typescript/common/type-builder.ts index 41b3627a8..169cf0de5 100644 --- a/packages/openapi-code-generator/src/typescript/common/type-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/type-builder.ts @@ -145,7 +145,9 @@ export class TypeBuilder implements ICompilable { result.push(...schemaObject.anyOf.flatMap(this.schemaObjectToTypes)) } - if (result.length === 0) { + if (schemaObject["x-alpha-transform"]?.type) { + result.push(schemaObject["x-alpha-transform"]?.type) + } else if (result.length === 0) { switch (schemaObject.type) { case "array": { result.push(array(this.schemaObjectToType(schemaObject.items))) From eb13aaf2edbfa995357586d8fb8713a1baa4ca6e Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 09:05:27 +0100 Subject: [PATCH 04/10] wip: roundtrip-transformations --- integration-tests-definitions/todo-lists.yaml | 11 ++ .../openapi-code-generator/src/core/input.ts | 7 + .../src/core/openapi-loader.ts | 5 + .../src/core/openapi-types-normalized.ts | 15 ++ .../src/core/openapi-types.ts | 17 ++ .../abstract-schema-builder.ts | 4 + .../src/typescript/common/type-builder.ts | 4 + packages/typescript-koa-runtime/src/zod.ts | 168 +++++++++++++++++- 8 files changed, 230 insertions(+), 1 deletion(-) diff --git a/integration-tests-definitions/todo-lists.yaml b/integration-tests-definitions/todo-lists.yaml index 2ef159672..c83edb961 100644 --- a/integration-tests-definitions/todo-lists.yaml +++ b/integration-tests-definitions/todo-lists.yaml @@ -177,6 +177,8 @@ components: updated: type: string format: date-time + x-transform: + $ref: '#/components/x-transforms/DateTime' parameters: listId: @@ -186,3 +188,12 @@ components: schema: type: string format: uuid + + x-transforms: + DateTime: + serialize: + fn: z.string().datetime().transform(it => new Date(it)) + type: Date + deserialize: + fn: z.date() + type: Date diff --git a/packages/openapi-code-generator/src/core/input.ts b/packages/openapi-code-generator/src/core/input.ts index 85f1a1a91..548f941c7 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, + xTransform, } from "./openapi-types" import type { IRModel, @@ -22,6 +23,7 @@ import type { IRParameter, IRRef, IRResponse, + IRTransform, MaybeIRModel, } from "./openapi-types-normalized" import {isRef} from "./openapi-utils" @@ -195,6 +197,10 @@ export class Input { return normalizeSchemaObject(schema) } + transform(maybeTransform: Reference | xTransform): IRTransform { + return this.loader.transform(maybeTransform) + } + private normalizeRequestBodyObject( operationId: string, requestBody?: RequestBody | Reference, @@ -369,6 +375,7 @@ function normalizeSchemaObject( nullable: schemaObject.nullable || false, readOnly: schemaObject.readOnly || false, "x-alpha-transform": schemaObject["x-alpha-transform"], + "x-transform": schemaObject["x-transform"], } 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..0e7dd7291 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, + xTransform, } 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 } + transform(maybeRef: Reference | xTransform): xTransform { + 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 f583423c0..77120f86b 100644 --- a/packages/openapi-code-generator/src/core/openapi-types-normalized.ts +++ b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts @@ -15,6 +15,21 @@ export interface IRModelBase { type?: string | undefined } | undefined + + "x-transform"?: MaybeIRTransform | undefined +} + +export type MaybeIRTransform = IRTransform | IRRef + +export type IRTransform = { + 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 4f9ad16b8..83fd5f77b 100644 --- a/packages/openapi-code-generator/src/core/openapi-types.ts +++ b/packages/openapi-code-generator/src/core/openapi-types.ts @@ -172,6 +172,11 @@ export interface Components { callbacks?: { [callbackName: string]: Callback | Reference } + "x-transforms"?: + | { + [transformName: string]: xTransform | Reference + } + | undefined } export interface Header { @@ -256,6 +261,18 @@ export interface Schema { type?: string | undefined } | undefined + "x-transform"?: xTransform | Reference | undefined +} + +export interface xTransform { + serialize: { + fn: string + type: string + } + deserialize: { + fn: string + type: string + } } export interface Discriminator { 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 2459e8fed..012d323e6 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 @@ -322,6 +322,10 @@ export abstract class AbstractSchemaBuilder< } } + if (model["x-transform"]) { + result = model["x-transform"] + } + if (nullable || model.nullable) { result = this.nullable(result) } diff --git a/packages/openapi-code-generator/src/typescript/common/type-builder.ts b/packages/openapi-code-generator/src/typescript/common/type-builder.ts index 169cf0de5..e450a16ef 100644 --- a/packages/openapi-code-generator/src/typescript/common/type-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/type-builder.ts @@ -147,6 +147,10 @@ export class TypeBuilder implements ICompilable { if (schemaObject["x-alpha-transform"]?.type) { result.push(schemaObject["x-alpha-transform"]?.type) + } else if (schemaObject["x-transform"]) { + // TODO: differentiate between serialization / deserialization + const dereferenced = this.input.transform(schemaObject["x-transform"]) + result.push(dereferenced.serialize.type) } else if (result.length === 0) { switch (schemaObject.type) { case "array": { diff --git a/packages/typescript-koa-runtime/src/zod.ts b/packages/typescript-koa-runtime/src/zod.ts index 87b1971de..56fb3e465 100644 --- a/packages/typescript-koa-runtime/src/zod.ts +++ b/packages/typescript-koa-runtime/src/zod.ts @@ -1,4 +1,4 @@ -import type {z} from "zod" +import {z} from "zod" import {KoaRuntimeError, type RequestInputType} from "./errors" export type Params = { @@ -7,6 +7,172 @@ export type Params = { body: Body } +export type Bidirectional< + Serialized, + Deserialized, + Serialize extends z.ZodType< + Serialized, + z.ZodTypeDef, + Deserialized + > = z.ZodType, + Deserialize extends z.ZodType< + Deserialized, + z.ZodTypeDef, + Serialized + > = z.ZodType, +> = { + _symbol: typeof _bidirectional + serialize: Serialize + deserialize: Deserialize +} + +const _bidirectional = Symbol("bidirectional") + +const s_datetime: Bidirectional = { + _symbol: _bidirectional, + serialize: z.date().transform((it) => it.toISOString()), + deserialize: z + .string() + .datetime() + .transform((it) => new Date(it)), +} + +s_datetime.deserialize.parse(new Date()) + +// (shape: T, params?: RawCreateParams) => +// ZodObject, any>]: objectUtil.addQuestionMarks, any>[k]; }, { [k_1 in keyof baseObjectInputType]: baseObjectInputType[k_1]; }>; + +type RoundTripRawShape = { + [key: string]: + | z.ZodTypeAny + | Bidirectional + | RoundTripRawShape +} + +// function expandTest( +// input: T, +// ): {[k in keyof T]: T[k] extends {value: number} ? T[k]["value"] : T[k]} { +// return Object.fromEntries( +// Object.entries(input).map(([key, value]) => [ +// key, +// typeof value === "number" ? value : value.value, +// ]), +// ) as any +// } + +// const foo = expandTest({ +// a: 123 as const, +// b: {value: 512}, +// }) + +function foo< + T extends Bidirectional, + U extends RoundTripRawShape, + V extends z.ZodTypeAny, +>( + it: U, +): { + [k in keyof U]: U[k] extends Bidirectional + ? U[k]["serialize"] + : U[k] +} +function foo< + T extends Bidirectional, + U extends RoundTripRawShape, + V extends z.ZodTypeAny, +>(it: V): V +function foo< + T extends Bidirectional, + U extends RoundTripRawShape, + V extends z.ZodTypeAny, +>(it: T): T["serialize"] +function foo< + T extends Bidirectional, + U extends RoundTripRawShape, + V extends z.ZodTypeAny, +>(it: T | U | V) {} + +function expandSerialize( + shape: T, +): { + [k in keyof T]: T[k] extends Bidirectional + ? T[k]["serialize"] + : T[k] +} { + return Object.fromEntries( + Object.entries(shape).map(([key, value]) => { + return [key, isZodSchema(value) ? value : value.serialize] as const + }), + // biome-ignore lint/suspicious/noExplicitAny: + ) as any +} + +function expandDeserialize( + shape: T, +): { + [k in keyof T]: T[k] extends Bidirectional + ? T[k]["deserialize"] + : T[k] +} { + return Object.fromEntries( + Object.entries(shape).map(([key, value]) => { + return [key, isZodSchema(value) ? value : value.deserialize] as const + }), + // biome-ignore lint/suspicious/noExplicitAny: + ) as any +} + +function expand(shape: T) { + return { + serialize: expandSerialize(shape), + deserialize: expandDeserialize(shape), + } +} + +function roundtripObject(properties: T) { + const shape = expand(properties) + return { + serialize: z.object(shape.serialize), + // deserialize: z.object(expandDeserialize(properties)), + } +} + +const foo3 = (() => { + const shape = expand({ + name: z.string(), + created: s_datetime, + nested: { + age: z.number(), + updated: s_datetime, + }, + }) + + return { + serialize: z.object(shape.serialize), + deserialize: z.object(shape.deserialize), + } +})() + +const s = foo3.deserialize.parse({}) + +const foo2 = z.object( + expand({ + name: z.string(), + created: s_datetime, + }).deserialize, +) + +const bar = foo2.parse({name: "test", created: "123"}) + +const result = foo.serialize.parse({ + name: "string", + created: new Date().toISOString(), +}) + +function isZodSchema(z: unknown): z is z.ZodTypeAny { + return typeof z === "object" && z !== null && Reflect.has(z, "parse") +} + export function parseRequestInput( schema: Schema, input: unknown, From e28dfc3a1170095af1e1d1e05749877b40f42394 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 09:17:53 +0100 Subject: [PATCH 05/10] fix: reduce scope --- integration-tests-definitions/todo-lists.yaml | 14 -- .../openapi-code-generator/src/core/input.ts | 11 +- .../src/core/openapi-loader.ts | 4 +- .../src/core/openapi-types-normalized.ts | 21 +-- .../src/core/openapi-types.ts | 24 +-- .../abstract-schema-builder.ts | 23 +-- .../schema-builders/joi-schema-builder.ts | 2 +- .../schema-builders/zod-schema-builder.ts | 2 +- .../src/typescript/common/type-builder.ts | 8 +- packages/typescript-koa-runtime/src/zod.ts | 164 +----------------- 10 files changed, 37 insertions(+), 236 deletions(-) diff --git a/integration-tests-definitions/todo-lists.yaml b/integration-tests-definitions/todo-lists.yaml index c83edb961..d58aa57a5 100644 --- a/integration-tests-definitions/todo-lists.yaml +++ b/integration-tests-definitions/todo-lists.yaml @@ -171,14 +171,9 @@ components: created: type: string format: date-time - x-alpha-transform: - fn: (it) => new Date(it) - type: Date updated: type: string format: date-time - x-transform: - $ref: '#/components/x-transforms/DateTime' parameters: listId: @@ -188,12 +183,3 @@ components: schema: type: string format: uuid - - x-transforms: - DateTime: - serialize: - fn: z.string().datetime().transform(it => new Date(it)) - type: Date - deserialize: - fn: z.date() - type: Date diff --git a/packages/openapi-code-generator/src/core/input.ts b/packages/openapi-code-generator/src/core/input.ts index 548f941c7..873c9ff95 100644 --- a/packages/openapi-code-generator/src/core/input.ts +++ b/packages/openapi-code-generator/src/core/input.ts @@ -9,7 +9,7 @@ import type { RequestBody, Responses, Schema, - xTransform, + xInternalPreproccess, } from "./openapi-types" import type { IRModel, @@ -21,9 +21,9 @@ import type { IRModelString, IROperation, IRParameter, + IRPreprocess, IRRef, IRResponse, - IRTransform, MaybeIRModel, } from "./openapi-types-normalized" import {isRef} from "./openapi-utils" @@ -197,8 +197,8 @@ export class Input { return normalizeSchemaObject(schema) } - transform(maybeTransform: Reference | xTransform): IRTransform { - return this.loader.transform(maybeTransform) + preprocess(maybePreprocess: Reference | xInternalPreproccess): IRPreprocess { + return this.loader.preprocess(maybePreprocess) } private normalizeRequestBodyObject( @@ -374,8 +374,7 @@ function normalizeSchemaObject( const base: IRModelBase = { nullable: schemaObject.nullable || false, readOnly: schemaObject.readOnly || false, - "x-alpha-transform": schemaObject["x-alpha-transform"], - "x-transform": schemaObject["x-transform"], + "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 0e7dd7291..3b2a1c8d9 100644 --- a/packages/openapi-code-generator/src/core/openapi-loader.ts +++ b/packages/openapi-code-generator/src/core/openapi-loader.ts @@ -14,7 +14,7 @@ import type { RequestBody, Response, Schema, - xTransform, + xInternalPreproccess, } from "./openapi-types" import {isRef} from "./openapi-utils" import type {OpenapiValidator} from "./openapi-validator" @@ -74,7 +74,7 @@ export class OpenapiLoader { return isRef(maybeRef) ? this.$ref(maybeRef) : maybeRef } - transform(maybeRef: Reference | xTransform): xTransform { + preprocess(maybeRef: Reference | xInternalPreproccess): xInternalPreproccess { return isRef(maybeRef) ? this.$ref(maybeRef) : maybeRef } 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 77120f86b..941b60bbb 100644 --- a/packages/openapi-code-generator/src/core/openapi-types-normalized.ts +++ b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts @@ -9,26 +9,19 @@ export interface IRModelBase { nullable: boolean /* false */ readOnly: boolean /* false */ - "x-alpha-transform"?: - | { - fn?: string | undefined - type?: string | undefined - } - | undefined - - "x-transform"?: MaybeIRTransform | undefined + "x-internal-preprocess"?: MaybeIRPreprocess | undefined } -export type MaybeIRTransform = IRTransform | IRRef +export type MaybeIRPreprocess = IRPreprocess | IRRef -export type IRTransform = { - serialize: { +export type IRPreprocess = { + serialize?: { fn: string - type: string + type?: string } - deserialize: { + deserialize?: { fn: string - type: string + type?: string } } diff --git a/packages/openapi-code-generator/src/core/openapi-types.ts b/packages/openapi-code-generator/src/core/openapi-types.ts index 83fd5f77b..2548ebb28 100644 --- a/packages/openapi-code-generator/src/core/openapi-types.ts +++ b/packages/openapi-code-generator/src/core/openapi-types.ts @@ -172,11 +172,6 @@ export interface Components { callbacks?: { [callbackName: string]: Callback | Reference } - "x-transforms"?: - | { - [transformName: string]: xTransform | Reference - } - | undefined } export interface Header { @@ -254,24 +249,17 @@ export interface Schema { deprecated?: boolean | undefined // xml?: XML | undefined - // TODO: not yet supported by joi - "x-alpha-transform"?: - | { - fn?: string | undefined - type?: string | undefined - } - | undefined - "x-transform"?: xTransform | Reference | undefined + "x-internal-preprocess"?: xInternalPreproccess | Reference | undefined } -export interface xTransform { - serialize: { +export interface xInternalPreproccess { + serialize?: { fn: string - type: string + type?: string } - deserialize: { + deserialize?: { fn: string - type: string + type?: 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 012d323e6..6399748ce 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 @@ -180,9 +180,11 @@ export abstract class AbstractSchemaBuilder< oneOf: [], required: [], anyOf: [parameter.schema, parameter.schema.items], - "x-alpha-transform": { - fn: ((it: unknown) => - Array.isArray(it) || it === undefined ? it : [it]).toString(), + "x-internal-preprocess": { + deserialize: { + fn: ((it: unknown) => + Array.isArray(it) || it === undefined ? it : [it]).toString(), + }, }, } } else { @@ -322,8 +324,13 @@ export abstract class AbstractSchemaBuilder< } } - if (model["x-transform"]) { - result = model["x-transform"] + 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) { @@ -332,10 +339,6 @@ export abstract class AbstractSchemaBuilder< result = required ? this.required(result) : this.optional(result) - if (model["x-alpha-transform"]?.fn) { - result = this.transform(result, model["x-alpha-transform"]?.fn) - } - return result } @@ -359,7 +362,7 @@ export abstract class AbstractSchemaBuilder< protected abstract union(schemas: string[]): string - protected abstract transform( + protected abstract preprocess( schema: string, transformation: string | ((it: unknown) => unknown), ): 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 eea526797..8b40dba7e 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,7 +108,7 @@ export class JoiBuilder extends AbstractSchemaBuilder< .join(".") } - protected transform( + protected preprocess( schema: string, transformation: string | ((it: unknown) => unknown), ) { 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 7f161c5bf..f7663811d 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,7 +133,7 @@ export class ZodBuilder extends AbstractSchemaBuilder< .join(".") } - protected transform( + protected preprocess( schema: string, transformation: string | ((it: unknown) => unknown), ) { diff --git a/packages/openapi-code-generator/src/typescript/common/type-builder.ts b/packages/openapi-code-generator/src/typescript/common/type-builder.ts index e450a16ef..41b3627a8 100644 --- a/packages/openapi-code-generator/src/typescript/common/type-builder.ts +++ b/packages/openapi-code-generator/src/typescript/common/type-builder.ts @@ -145,13 +145,7 @@ export class TypeBuilder implements ICompilable { result.push(...schemaObject.anyOf.flatMap(this.schemaObjectToTypes)) } - if (schemaObject["x-alpha-transform"]?.type) { - result.push(schemaObject["x-alpha-transform"]?.type) - } else if (schemaObject["x-transform"]) { - // TODO: differentiate between serialization / deserialization - const dereferenced = this.input.transform(schemaObject["x-transform"]) - result.push(dereferenced.serialize.type) - } else if (result.length === 0) { + if (result.length === 0) { switch (schemaObject.type) { case "array": { result.push(array(this.schemaObjectToType(schemaObject.items))) diff --git a/packages/typescript-koa-runtime/src/zod.ts b/packages/typescript-koa-runtime/src/zod.ts index 56fb3e465..930c486c5 100644 --- a/packages/typescript-koa-runtime/src/zod.ts +++ b/packages/typescript-koa-runtime/src/zod.ts @@ -1,4 +1,4 @@ -import {z} from "zod" +import type {z} from "zod" import {KoaRuntimeError, type RequestInputType} from "./errors" export type Params = { @@ -7,168 +7,6 @@ export type Params = { body: Body } -export type Bidirectional< - Serialized, - Deserialized, - Serialize extends z.ZodType< - Serialized, - z.ZodTypeDef, - Deserialized - > = z.ZodType, - Deserialize extends z.ZodType< - Deserialized, - z.ZodTypeDef, - Serialized - > = z.ZodType, -> = { - _symbol: typeof _bidirectional - serialize: Serialize - deserialize: Deserialize -} - -const _bidirectional = Symbol("bidirectional") - -const s_datetime: Bidirectional = { - _symbol: _bidirectional, - serialize: z.date().transform((it) => it.toISOString()), - deserialize: z - .string() - .datetime() - .transform((it) => new Date(it)), -} - -s_datetime.deserialize.parse(new Date()) - -// (shape: T, params?: RawCreateParams) => -// ZodObject, any>]: objectUtil.addQuestionMarks, any>[k]; }, { [k_1 in keyof baseObjectInputType]: baseObjectInputType[k_1]; }>; - -type RoundTripRawShape = { - [key: string]: - | z.ZodTypeAny - | Bidirectional - | RoundTripRawShape -} - -// function expandTest( -// input: T, -// ): {[k in keyof T]: T[k] extends {value: number} ? T[k]["value"] : T[k]} { -// return Object.fromEntries( -// Object.entries(input).map(([key, value]) => [ -// key, -// typeof value === "number" ? value : value.value, -// ]), -// ) as any -// } - -// const foo = expandTest({ -// a: 123 as const, -// b: {value: 512}, -// }) - -function foo< - T extends Bidirectional, - U extends RoundTripRawShape, - V extends z.ZodTypeAny, ->( - it: U, -): { - [k in keyof U]: U[k] extends Bidirectional - ? U[k]["serialize"] - : U[k] -} -function foo< - T extends Bidirectional, - U extends RoundTripRawShape, - V extends z.ZodTypeAny, ->(it: V): V -function foo< - T extends Bidirectional, - U extends RoundTripRawShape, - V extends z.ZodTypeAny, ->(it: T): T["serialize"] -function foo< - T extends Bidirectional, - U extends RoundTripRawShape, - V extends z.ZodTypeAny, ->(it: T | U | V) {} - -function expandSerialize( - shape: T, -): { - [k in keyof T]: T[k] extends Bidirectional - ? T[k]["serialize"] - : T[k] -} { - return Object.fromEntries( - Object.entries(shape).map(([key, value]) => { - return [key, isZodSchema(value) ? value : value.serialize] as const - }), - // biome-ignore lint/suspicious/noExplicitAny: - ) as any -} - -function expandDeserialize( - shape: T, -): { - [k in keyof T]: T[k] extends Bidirectional - ? T[k]["deserialize"] - : T[k] -} { - return Object.fromEntries( - Object.entries(shape).map(([key, value]) => { - return [key, isZodSchema(value) ? value : value.deserialize] as const - }), - // biome-ignore lint/suspicious/noExplicitAny: - ) as any -} - -function expand(shape: T) { - return { - serialize: expandSerialize(shape), - deserialize: expandDeserialize(shape), - } -} - -function roundtripObject(properties: T) { - const shape = expand(properties) - return { - serialize: z.object(shape.serialize), - // deserialize: z.object(expandDeserialize(properties)), - } -} - -const foo3 = (() => { - const shape = expand({ - name: z.string(), - created: s_datetime, - nested: { - age: z.number(), - updated: s_datetime, - }, - }) - - return { - serialize: z.object(shape.serialize), - deserialize: z.object(shape.deserialize), - } -})() - -const s = foo3.deserialize.parse({}) - -const foo2 = z.object( - expand({ - name: z.string(), - created: s_datetime, - }).deserialize, -) - -const bar = foo2.parse({name: "test", created: "123"}) - -const result = foo.serialize.parse({ - name: "string", - created: new Date().toISOString(), -}) - function isZodSchema(z: unknown): z is z.ZodTypeAny { return typeof z === "object" && z !== null && Reflect.has(z, "parse") } From 2988823d33c7775a44c8251511634ad7cfe030fd Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 09:28:36 +0100 Subject: [PATCH 06/10] fix: reduce scope --- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../api.github.com.yaml/generated.ts | 40 +- .../generated.ts | 8 +- .../petstore-expanded.yaml/generated.ts | 8 +- .../src/generated/stripe.yaml/generated.ts | 2276 +++++++++-------- .../src/generated/todo-lists.yaml/models.ts | 2 +- .../src/generated/todo-lists.yaml/schemas.ts | 5 +- .../abstract-schema-builder.ts | 10 +- .../schema-builders/zod-schema-builder.ts | 2 +- 11 files changed, 1321 insertions(+), 1036 deletions(-) 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 6633a8fe6..28740557b 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 @@ -12,7 +12,7 @@ export type t_CreateUpdateTodoList = { } export type t_TodoList = { - created: Date + created: string id: string incompleteItemCount: number name: string 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 6633a8fe6..28740557b 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 @@ -12,7 +12,7 @@ export type t_CreateUpdateTodoList = { } export type t_TodoList = { - created: Date + created: string id: string incompleteItemCount: number name: string 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 6633a8fe6..28740557b 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 @@ -12,7 +12,7 @@ export type t_CreateUpdateTodoList = { } export type t_TodoList = { - created: Date + created: string id: string incompleteItemCount: number name: 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 7bdab152d..7b66d132b 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 @@ -34474,9 +34474,11 @@ export function createRouter(implementation: Implementation): KoaRouter { per_page: z.coerce.number().optional(), page: z.coerce.number().optional(), exclude: z - .union([z.array(z.enum(["repositories"])), z.enum(["repositories"])]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), }) const migrationsListForOrgResponseValidator = responseValidationFactory( @@ -34604,9 +34606,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const migrationsGetStatusForOrgQuerySchema = z.object({ exclude: z - .union([z.array(z.enum(["repositories"])), z.enum(["repositories"])]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), }) const migrationsGetStatusForOrgResponseValidator = responseValidationFactory( @@ -36248,9 +36252,11 @@ export function createRouter(implementation: Implementation): KoaRouter { sort: z.enum(["created_at"]).optional(), direction: z.enum(["asc", "desc"]).optional(), owner: z - .union([z.array(z.string()).max(10), z.string()]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -36560,9 +36566,11 @@ export function createRouter(implementation: Implementation): KoaRouter { sort: z.enum(["created_at"]).optional(), direction: z.enum(["asc", "desc"]).optional(), owner: z - .union([z.array(z.string()).max(10), z.string()]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -77635,9 +77643,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const migrationsGetStatusForAuthenticatedUserQuerySchema = z.object({ exclude: z - .union([z.array(z.string()), z.string()]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 11a4923b4..2347c99aa 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 @@ -1041,9 +1041,11 @@ export function createRouter(implementation: Implementation): KoaRouter { skip: z.coerce.number().optional(), maxpagesize: z.coerce.number().optional(), select: z - .union([z.array(z.string()), z.string()]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 56e9014fc..6d9bb7bfd 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 @@ -103,9 +103,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const findPetsQuerySchema = z.object({ tags: z - .union([z.array(z.string()), z.string()]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 6f4895e98..5683989bd 100644 --- a/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts @@ -13627,9 +13627,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountBodySchema = z.object({}).optional() @@ -13912,9 +13914,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -14638,9 +14642,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountBodySchema = z.object({}).optional() @@ -15422,9 +15428,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountBankAccountsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountBankAccountsIdBodySchema = z.object({}).optional() @@ -15570,9 +15578,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountCapabilitiesQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountCapabilitiesBodySchema = z.object({}).optional() @@ -15654,9 +15664,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountCapabilitiesCapabilityQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountCapabilitiesCapabilityBodySchema = z @@ -15788,9 +15800,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountExternalAccountsQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -16028,9 +16042,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountExternalAccountsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountExternalAccountsIdBodySchema = z.object({}).optional() @@ -16236,9 +16252,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPeopleQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), relationship: z .object({ @@ -16587,9 +16605,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPeoplePersonQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountPeoplePersonBodySchema = z.object({}).optional() @@ -16851,9 +16871,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPersonsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), relationship: z .object({ @@ -17202,9 +17224,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPersonsPersonQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getAccountsAccountPersonsPersonBodySchema = z.object({}).optional() @@ -17522,9 +17546,11 @@ export function createRouter(implementation: Implementation): KoaRouter { domain_name: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -17707,9 +17733,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplePayDomainsDomainQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getApplePayDomainsDomainBodySchema = z.object({}).optional() @@ -17783,9 +17811,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -17864,9 +17894,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesFeeRefundsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getApplicationFeesFeeRefundsIdBodySchema = z.object({}).optional() @@ -17987,9 +18019,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getApplicationFeesIdBodySchema = z.object({}).optional() @@ -18115,9 +18149,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesIdRefundsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -18257,9 +18293,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAppsSecretsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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"]), @@ -18441,9 +18479,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAppsSecretsFindQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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"]), @@ -18505,9 +18545,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBalanceBodySchema = z.object({}).optional() @@ -18573,9 +18615,11 @@ export function createRouter(implementation: Implementation): KoaRouter { currency: z.string().optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -18653,9 +18697,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceHistoryIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBalanceHistoryIdBodySchema = z.object({}).optional() @@ -18729,9 +18775,11 @@ export function createRouter(implementation: Implementation): KoaRouter { currency: z.string().optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -18815,9 +18863,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceTransactionsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBalanceTransactionsIdBodySchema = z.object({}).optional() @@ -18987,9 +19037,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingMetersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -19121,9 +19173,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingMetersIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBillingMetersIdBodySchema = z.object({}).optional() @@ -19306,9 +19360,11 @@ export function createRouter(implementation: Implementation): KoaRouter { end_time: z.coerce.number(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -19450,9 +19506,11 @@ export function createRouter(implementation: Implementation): KoaRouter { active: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -19670,9 +19728,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingPortalConfigurationsConfigurationQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getBillingPortalConfigurationsConfigurationBodySchema = z @@ -20073,9 +20133,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -20263,9 +20325,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -20342,9 +20406,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getChargesChargeBodySchema = z.object({}).optional() @@ -20555,9 +20621,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeDisputeQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getChargesChargeDisputeBodySchema = z.object({}).optional() @@ -20839,9 +20907,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeRefundsQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -20996,9 +21066,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeRefundsRefundQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getChargesChargeRefundsRefundBodySchema = z.object({}).optional() @@ -21131,9 +21203,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer_details: z.object({ email: z.string() }).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -22228,9 +22302,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCheckoutSessionsSessionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCheckoutSessionsSessionBodySchema = z.object({}).optional() @@ -22414,9 +22490,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCheckoutSessionsSessionLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -22499,9 +22577,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateOrdersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -22627,9 +22707,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateOrdersOrderQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getClimateOrdersOrderBodySchema = z.object({}).optional() @@ -22816,9 +22898,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateProductsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -22896,9 +22980,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateProductsProductQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getClimateProductsProductBodySchema = z.object({}).optional() @@ -22960,9 +23046,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateSuppliersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -23040,9 +23128,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateSuppliersSupplierQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getClimateSuppliersSupplierBodySchema = z.object({}).optional() @@ -23105,9 +23195,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getConfirmationTokensConfirmationTokenQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getConfirmationTokensConfirmationTokenBodySchema = z @@ -23172,9 +23264,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCountrySpecsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -23248,9 +23342,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCountrySpecsCountryQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCountrySpecsCountryBodySchema = z.object({}).optional() @@ -23323,9 +23419,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -23517,9 +23615,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCouponsCouponQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCouponsCouponBodySchema = z.object({}).optional() @@ -23650,9 +23750,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -23822,12 +23924,15 @@ export function createRouter(implementation: Implementation): KoaRouter { effective_at: z.coerce.number().optional(), email_type: z.enum(["credit_note", "none"]).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice: z.string().max(5000), lines: z - .union([ + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -23854,33 +23959,8 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount_decimal: z.string().optional(), }), ), - 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() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ) + .optional(), memo: z.string().max(5000).optional(), metadata: z.record(z.string()).optional(), out_of_band_amount: z.coerce.number().optional(), @@ -23958,13 +24038,16 @@ export function createRouter(implementation: Implementation): KoaRouter { email_type: z.enum(["credit_note", "none"]).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 - .union([ + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -23991,33 +24074,8 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount_decimal: z.string().optional(), }), ), - 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() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ) + .optional(), memo: z.string().max(5000).optional(), metadata: z.record(z.string()).optional(), out_of_band_amount: z.coerce.number().optional(), @@ -24111,9 +24169,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCreditNotesCreditNoteLinesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -24194,9 +24254,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCreditNotesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCreditNotesIdBodySchema = z.object({}).optional() @@ -24460,9 +24522,11 @@ export function createRouter(implementation: Implementation): KoaRouter { email: z.string().max(512).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -24752,9 +24816,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -24893,9 +24959,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerBodySchema = z.object({}).optional() @@ -25146,9 +25214,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBalanceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -25302,9 +25372,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBalanceTransactionsTransactionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerBalanceTransactionsTransactionBodySchema = z @@ -25454,9 +25526,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBankAccountsQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -25708,9 +25782,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBankAccountsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerBankAccountsIdBodySchema = z.object({}).optional() @@ -25943,9 +26019,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCardsQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -26192,9 +26270,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCardsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerCardsIdBodySchema = z.object({}).optional() @@ -26357,9 +26437,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCashBalanceQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerCashBalanceBodySchema = z.object({}).optional() @@ -26488,9 +26570,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCashBalanceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -26578,9 +26662,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCashBalanceTransactionsTransactionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerCashBalanceTransactionsTransactionBodySchema = z @@ -26712,9 +26798,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerDiscountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerDiscountBodySchema = z.object({}).optional() @@ -26853,9 +26941,11 @@ export function createRouter(implementation: Implementation): KoaRouter { allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -26983,9 +27073,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerPaymentMethodsPaymentMethodBodySchema = z @@ -27055,9 +27147,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSourcesQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -27310,9 +27404,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSourcesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerSourcesIdBodySchema = z.object({}).optional() @@ -27539,9 +27635,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSubscriptionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -28102,9 +28200,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z @@ -28685,9 +28785,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountBodySchema = @@ -28760,9 +28862,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerTaxIdsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -29032,9 +29136,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerTaxIdsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getCustomersCustomerTaxIdsIdBodySchema = z.object({}).optional() @@ -29106,9 +29212,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -29183,9 +29291,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getDisputesDisputeQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getDisputesDisputeBodySchema = z.object({}).optional() @@ -29399,9 +29509,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -29483,9 +29595,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEntitlementsActiveEntitlementsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEntitlementsActiveEntitlementsIdBodySchema = z.object({}).optional() @@ -29552,9 +29666,11 @@ export function createRouter(implementation: Implementation): KoaRouter { archived: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -29689,9 +29805,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEntitlementsFeaturesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEntitlementsFeaturesIdBodySchema = z.object({}).optional() @@ -29938,16 +30056,20 @@ export function createRouter(implementation: Implementation): KoaRouter { delivery_success: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEventsBodySchema = z.object({}).optional() @@ -30017,9 +30139,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEventsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getEventsIdBodySchema = z.object({}).optional() @@ -30077,9 +30201,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getExchangeRatesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -30153,9 +30279,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getExchangeRatesRateIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getExchangeRatesRateIdBodySchema = z.object({}).optional() @@ -30228,9 +30356,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -30353,9 +30483,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFileLinksLinkQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFileLinksLinkBodySchema = z.object({}).optional() @@ -30486,9 +30618,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), purpose: z .enum([ @@ -30645,9 +30779,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFilesFileQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFilesFileBodySchema = z.object({}).optional() @@ -30711,9 +30847,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -30796,9 +30934,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsAccountsAccountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFinancialConnectionsAccountsAccountBodySchema = z @@ -30937,9 +31077,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsAccountsAccountOwnersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -31304,9 +31446,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsSessionsSessionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFinancialConnectionsSessionsSessionBodySchema = z @@ -31375,9 +31519,11 @@ export function createRouter(implementation: Implementation): KoaRouter { account: z.string().max(5000), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -31474,9 +31620,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsTransactionsTransactionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getFinancialConnectionsTransactionsTransactionBodySchema = z @@ -31555,9 +31703,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -31703,9 +31853,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getForwardingRequestsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getForwardingRequestsIdBodySchema = z.object({}).optional() @@ -31779,9 +31931,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -31865,9 +32019,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIdentityVerificationReportsReportQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIdentityVerificationReportsReportBodySchema = z.object({}).optional() @@ -31945,9 +32101,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -32110,9 +32268,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIdentityVerificationSessionsSessionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIdentityVerificationSessionsSessionBodySchema = z @@ -32402,9 +32562,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -32621,9 +32783,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoiceitemsInvoiceitemQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getInvoiceitemsInvoiceitemBodySchema = z.object({}).optional() @@ -32810,9 +32974,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -33743,9 +33909,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoicesSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -33968,11 +34136,14 @@ export function createRouter(implementation: Implementation): KoaRouter { ]) .optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice_items: z - .union([ + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -34020,54 +34191,8 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount_decimal: z.string().optional(), }), ), - 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() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ) + .optional(), issuer: z .object({ account: z.string().optional(), @@ -34331,7 +34456,8 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), subscription_items: z - .union([ + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ billing_thresholds: z @@ -34375,50 +34501,8 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), }), ), - 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(), - }), - 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() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ) + .optional(), subscription_proration_behavior: z .enum(["always_invoice", "create_prorations", "none"]) .optional(), @@ -34633,11 +34717,14 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), invoice_items: z - .union([ + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -34685,54 +34772,8 @@ export function createRouter(implementation: Implementation): KoaRouter { unit_amount_decimal: z.string().optional(), }), ), - 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() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ) + .optional(), issuer: z .object({ account: z.string().optional(), @@ -34998,7 +35039,8 @@ export function createRouter(implementation: Implementation): KoaRouter { }) .optional(), subscription_items: z - .union([ + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ billing_thresholds: z @@ -35042,50 +35084,8 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), }), ), - 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(), - }), - 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() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + ) + .optional(), subscription_proration_behavior: z .enum(["always_invoice", "create_prorations", "none"]) .optional(), @@ -35226,9 +35226,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoicesInvoiceQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getInvoicesInvoiceBodySchema = z.object({}).optional() @@ -35868,9 +35870,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoicesInvoiceLinesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -36550,9 +36554,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -36634,9 +36640,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingAuthorizationsAuthorizationQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingAuthorizationsAuthorizationBodySchema = z @@ -36900,9 +36908,11 @@ export function createRouter(implementation: Implementation): KoaRouter { email: z.string().optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -38017,9 +38027,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingCardholdersCardholderQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingCardholdersCardholderBodySchema = z.object({}).optional() @@ -39132,9 +39144,11 @@ export function createRouter(implementation: Implementation): KoaRouter { exp_month: z.coerce.number().optional(), exp_year: z.coerce.number().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -40226,9 +40240,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingCardsCardQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingCardsCardBodySchema = z.object({}).optional() @@ -41321,9 +41337,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -41639,9 +41657,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingDisputesDisputeQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingDisputesDisputeBodySchema = z.object({}).optional() @@ -42002,14 +42022,18 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPersonalizationDesignsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), lookup_keys: z - .union([z.array(z.string().max(200)), z.string().max(200)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(200)), + ) + .optional(), preferences: z .object({ is_default: PermissiveBoolean.optional(), @@ -42166,9 +42190,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPersonalizationDesignsPersonalizationDesignQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingPersonalizationDesignsPersonalizationDesignBodySchema = z @@ -42335,9 +42361,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPhysicalBundlesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -42420,9 +42448,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPhysicalBundlesPhysicalBundleQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingPhysicalBundlesPhysicalBundleBodySchema = z @@ -42490,9 +42520,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingSettlementsSettlementQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingSettlementsSettlementBodySchema = z.object({}).optional() @@ -42623,9 +42655,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -42700,9 +42734,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingTokensTokenQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingTokensTokenBodySchema = z.object({}).optional() @@ -42836,9 +42872,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -42920,9 +42958,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingTransactionsTransactionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getIssuingTransactionsTransactionBodySchema = z.object({}).optional() @@ -43128,9 +43168,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getLinkAccountSessionsSessionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getLinkAccountSessionsSessionBodySchema = z.object({}).optional() @@ -43199,9 +43241,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -43279,9 +43323,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getLinkedAccountsAccountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getLinkedAccountsAccountBodySchema = z.object({}).optional() @@ -43409,9 +43455,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getLinkedAccountsAccountOwnersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -43553,9 +43601,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getMandatesMandateQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getMandatesMandateBodySchema = z.object({}).optional() @@ -43629,9 +43679,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -44712,9 +44764,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentIntentsSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -44798,9 +44852,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentIntentsIntentQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentIntentsIntentBodySchema = z.object({}).optional() @@ -47204,9 +47260,11 @@ export function createRouter(implementation: Implementation): KoaRouter { active: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -47810,9 +47868,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentLinksPaymentLinkQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentLinksPaymentLinkBodySchema = z.object({}).optional() @@ -48419,9 +48479,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentLinksPaymentLinkLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -48505,9 +48567,11 @@ export function createRouter(implementation: Implementation): KoaRouter { application: z.union([z.string().max(100), z.enum([""])]).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -48931,9 +48995,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodConfigurationsConfigurationQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentMethodConfigurationsConfigurationBodySchema = z @@ -49356,9 +49422,11 @@ export function createRouter(implementation: Implementation): KoaRouter { enabled: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -49491,9 +49559,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodDomainsPaymentMethodDomainQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentMethodDomainsPaymentMethodDomainBodySchema = z @@ -49684,9 +49754,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -50130,9 +50202,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodsPaymentMethodQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPaymentMethodsPaymentMethodBodySchema = z.object({}).optional() @@ -50434,9 +50508,11 @@ export function createRouter(implementation: Implementation): KoaRouter { destination: z.string().optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -50563,9 +50639,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPayoutsPayoutQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPayoutsPayoutBodySchema = z.object({}).optional() @@ -50811,9 +50889,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -51027,9 +51107,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPlansPlanQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPlansPlanBodySchema = z.object({}).optional() @@ -51159,14 +51241,18 @@ export function createRouter(implementation: Implementation): KoaRouter { currency: z.string().optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), lookup_keys: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), product: z.string().max(5000).optional(), recurring: z .object({ @@ -51376,9 +51462,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPricesSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -51455,9 +51543,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPricesPriceQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPricesPriceBodySchema = z.object({}).optional() @@ -51622,13 +51712,17 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), ids: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -51814,9 +51908,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -51943,9 +52039,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getProductsIdBodySchema = z.object({}).optional() @@ -52089,9 +52187,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsProductFeaturesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -52286,9 +52386,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsProductFeaturesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getProductsProductFeaturesIdBodySchema = z.object({}).optional() @@ -52363,9 +52465,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -52506,9 +52610,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPromotionCodesPromotionCodeQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getPromotionCodesPromotionCodeBodySchema = z.object({}).optional() @@ -52636,9 +52742,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -52886,9 +52994,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getQuotesQuoteBodySchema = z.object({}).optional() @@ -53240,9 +53350,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteComputedUpfrontLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -53392,9 +53504,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -53474,9 +53588,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuotePdfQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getQuotesQuotePdfBodySchema = z.object({}).optional() @@ -53550,9 +53666,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -53634,9 +53752,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRadarEarlyFraudWarningsEarlyFraudWarningBodySchema = z @@ -53712,9 +53832,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -53906,9 +54028,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRadarValueListItemsItemQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRadarValueListItemsItemBodySchema = z.object({}).optional() @@ -53983,9 +54107,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -54184,9 +54310,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRadarValueListsValueListQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRadarValueListsValueListBodySchema = z.object({}).optional() @@ -54319,9 +54447,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -54455,9 +54585,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRefundsRefundQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getRefundsRefundBodySchema = z.object({}).optional() @@ -54637,9 +54769,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -55424,9 +55558,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReportingReportRunsReportRunQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReportingReportRunsReportRunBodySchema = z.object({}).optional() @@ -55485,9 +55621,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReportingReportTypesQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReportingReportTypesBodySchema = z.object({}).optional() @@ -55563,9 +55701,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReportingReportTypesReportTypeQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReportingReportTypesReportTypeBodySchema = z.object({}).optional() @@ -55639,9 +55779,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -55713,9 +55855,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReviewsReviewQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getReviewsReviewBodySchema = z.object({}).optional() @@ -55842,9 +55986,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -55929,9 +56075,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -56501,9 +56649,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSetupIntentsIntentQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSetupIntentsIntentBodySchema = z.object({}).optional() @@ -57671,9 +57821,11 @@ export function createRouter(implementation: Implementation): KoaRouter { currency: z.string().optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -57830,9 +57982,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getShippingRatesShippingRateTokenQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getShippingRatesShippingRateTokenBodySchema = z.object({}).optional() @@ -57975,9 +58129,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSigmaScheduledQueryRunsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -58058,9 +58214,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSigmaScheduledQueryRunsScheduledQueryRunBodySchema = z @@ -58277,9 +58435,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSourcesSourceQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSourcesSourceBodySchema = z.object({}).optional() @@ -58483,9 +58643,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSourcesSourceMandateNotificationsMandateNotificationQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSourcesSourceMandateNotificationsMandateNotificationBodySchema = z @@ -58559,9 +58721,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSourcesSourceSourceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -58650,9 +58814,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSourcesSourceSourceTransactionsSourceTransactionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSourcesSourceSourceTransactionsSourceTransactionBodySchema = z @@ -58781,9 +58947,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionItemsQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -59026,9 +59194,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionItemsItemQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSubscriptionItemsItemBodySchema = z.object({}).optional() @@ -59203,9 +59373,11 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -59396,9 +59568,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), released_at: z .union([ @@ -59760,9 +59934,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionSchedulesScheduleQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSubscriptionSchedulesScheduleBodySchema = z.object({}).optional() @@ -60265,9 +60441,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -60748,9 +60926,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionsSearchQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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), @@ -60914,9 +61094,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getSubscriptionsSubscriptionExposedIdBodySchema = z @@ -61732,9 +61914,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCalculationsCalculationLineItemsQuerySchema = z.object({ ending_before: z.string().max(500).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -61822,9 +62006,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxRegistrationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -62280,9 +62466,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxRegistrationsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxRegistrationsIdBodySchema = z.object({}).optional() @@ -62407,9 +62595,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxSettingsQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxSettingsBodySchema = z.object({}).optional() @@ -62660,9 +62850,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxTransactionsTransactionQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxTransactionsTransactionBodySchema = z.object({}).optional() @@ -62726,9 +62918,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxTransactionsTransactionLineItemsQuerySchema = z.object({ ending_before: z.string().max(500).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -62816,9 +63010,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCodesQuerySchema = z.object({ ending_before: z.string().optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), starting_after: z.string().optional(), }) @@ -62890,9 +63086,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCodesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxCodesIdBodySchema = z.object({}).optional() @@ -62950,9 +63148,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxIdsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), limit: z.coerce.number().optional(), owner: z .object({ @@ -63210,9 +63410,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxIdsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxIdsIdBodySchema = z.object({}).optional() @@ -63282,9 +63484,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -63430,9 +63634,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxRatesTaxRateQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTaxRatesTaxRateBodySchema = z.object({}).optional() @@ -63577,9 +63783,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalConfigurationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -63902,9 +64110,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalConfigurationsConfigurationQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTerminalConfigurationsConfigurationBodySchema = z @@ -64249,9 +64459,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalLocationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -64447,9 +64659,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalLocationsLocationQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTerminalLocationsLocationBodySchema = z.object({}).optional() @@ -64604,9 +64818,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -64795,9 +65011,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalReadersReaderQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTerminalReadersReaderBodySchema = z.object({}).optional() @@ -68265,9 +68483,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTestHelpersTestClocksQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -68460,9 +68680,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTestHelpersTestClocksTestClockQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTestHelpersTestClocksTestClockBodySchema = z.object({}).optional() @@ -69913,9 +70135,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTokensTokenQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTokensTokenBodySchema = z.object({}).optional() @@ -69995,9 +70219,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -70123,9 +70349,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTopupsTopupQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTopupsTopupBodySchema = z.object({}).optional() @@ -70309,9 +70537,11 @@ export function createRouter(implementation: Implementation): KoaRouter { destination: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -70441,9 +70671,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTransfersIdReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -70589,9 +70821,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTransfersTransferQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTransfersTransferBodySchema = z.object({}).optional() @@ -70719,9 +70953,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTransfersTransferReversalsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTransfersTransferReversalsIdBodySchema = z.object({}).optional() @@ -70841,9 +71077,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryCreditReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -70974,9 +71212,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryCreditReversalsCreditReversalQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryCreditReversalsCreditReversalBodySchema = z @@ -71041,9 +71281,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryDebitReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -71177,9 +71419,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryDebitReversalsDebitReversalQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryDebitReversalsDebitReversalBodySchema = z @@ -71255,9 +71499,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -71432,9 +71678,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryFinancialAccountsFinancialAccountQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryFinancialAccountsFinancialAccountBodySchema = z @@ -71607,9 +71855,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryFinancialAccountsFinancialAccountFeaturesBodySchema = z @@ -71779,9 +72029,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryInboundTransfersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -71919,9 +72171,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryInboundTransfersIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryInboundTransfersIdBodySchema = z.object({}).optional() @@ -72057,9 +72311,11 @@ export function createRouter(implementation: Implementation): KoaRouter { customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -72252,9 +72508,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryOutboundPaymentsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryOutboundPaymentsIdBodySchema = z.object({}).optional() @@ -72373,9 +72631,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryOutboundTransfersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -72525,9 +72785,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryOutboundTransfersOutboundTransferQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryOutboundTransfersOutboundTransferBodySchema = z @@ -72655,9 +72917,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedCreditsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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 @@ -72747,9 +73011,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedCreditsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryReceivedCreditsIdBodySchema = z.object({}).optional() @@ -72809,9 +73075,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedDebitsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -72891,9 +73159,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedDebitsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryReceivedDebitsIdBodySchema = z.object({}).optional() @@ -72975,9 +73245,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -73062,9 +73334,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryTransactionEntriesIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryTransactionEntriesIdBodySchema = z.object({}).optional() @@ -73135,9 +73409,11 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), @@ -73233,9 +73509,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryTransactionsIdQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), }) const getTreasuryTransactionsIdBodySchema = z.object({}).optional() @@ -73297,9 +73575,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getWebhookEndpointsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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(), }) @@ -73837,9 +74117,11 @@ export function createRouter(implementation: Implementation): KoaRouter { const getWebhookEndpointsWebhookEndpointQuerySchema = z.object({ expand: z - .union([z.array(z.string().max(5000)), z.string().max(5000)]) - .optional() - .transform((it) => (Array.isArray(it) || it === undefined ? it : [it])), + .preprocess( + (it) => (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/models.ts b/integration-tests/typescript-koa/src/generated/todo-lists.yaml/models.ts index 693c813d7..da6dcb289 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 @@ -8,7 +8,7 @@ export type t_Error = { } export type t_TodoList = { - created: Date + created: string id: string incompleteItemCount: number name: string 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 b276b1a7d..3c99ec6ce 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 @@ -11,10 +11,7 @@ export const s_TodoList = z.object({ name: z.string(), totalItemCount: z.coerce.number(), incompleteItemCount: z.coerce.number(), - created: z - .string() - .datetime({ offset: true }) - .transform((it) => new Date(it)), + created: z.string().datetime({ offset: true }), updated: z.string().datetime({ offset: true }), }) 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 6399748ce..493ff154d 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 @@ -171,15 +171,7 @@ export abstract class AbstractSchemaBuilder< parameter.schema.type === "array" ) { model.properties[parameter.name] = { - type: "object", - additionalProperties: false, - properties: {}, - readOnly: false, - allOf: [], - nullable: false, - oneOf: [], - required: [], - anyOf: [parameter.schema, parameter.schema.items], + ...parameter.schema, "x-internal-preprocess": { deserialize: { fn: ((it: unknown) => 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 f7663811d..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 @@ -137,7 +137,7 @@ export class ZodBuilder extends AbstractSchemaBuilder< schema: string, transformation: string | ((it: unknown) => unknown), ) { - return [schema, `transform(${transformation.toString()})`] + return [zod, `preprocess(${transformation.toString()}, ${schema})`] .filter(isDefined) .join(".") } From 26ea04ef94dcb7503e469b9746b5ee18f468bd2e Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 10:32:46 +0100 Subject: [PATCH 07/10] fix: hacky joi support --- .../api.github.com.yaml/generated.ts | 10 +- .../generated.ts | 2 +- .../petstore-expanded.yaml/generated.ts | 2 +- .../src/generated/stripe.yaml/generated.ts | 514 +++++++++--------- .../abstract-schema-builder.ts | 3 +- .../schema-builders/joi-schema-builder.ts | 16 +- 6 files changed, 279 insertions(+), 268 deletions(-) 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 7b66d132b..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 @@ -34475,7 +34475,7 @@ export function createRouter(implementation: Implementation): KoaRouter { page: z.coerce.number().optional(), exclude: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.enum(["repositories"])), ) .optional(), @@ -34607,7 +34607,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const migrationsGetStatusForOrgQuerySchema = z.object({ exclude: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.enum(["repositories"])), ) .optional(), @@ -36253,7 +36253,7 @@ export function createRouter(implementation: Implementation): KoaRouter { direction: z.enum(["asc", "desc"]).optional(), owner: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string()).max(10), ) .optional(), @@ -36567,7 +36567,7 @@ export function createRouter(implementation: Implementation): KoaRouter { direction: z.enum(["asc", "desc"]).optional(), owner: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string()).max(10), ) .optional(), @@ -77644,7 +77644,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const migrationsGetStatusForAuthenticatedUserQuerySchema = z.object({ exclude: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string()), ) .optional(), 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 2347c99aa..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 @@ -1042,7 +1042,7 @@ export function createRouter(implementation: Implementation): KoaRouter { maxpagesize: z.coerce.number().optional(), select: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string()), ) .optional(), 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 6d9bb7bfd..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 @@ -104,7 +104,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const findPetsQuerySchema = z.object({ tags: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string()), ) .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 5683989bd..c3ebb1a3a 100644 --- a/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts +++ b/integration-tests/typescript-koa/src/generated/stripe.yaml/generated.ts @@ -13628,7 +13628,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -13915,7 +13915,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -14643,7 +14643,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -15429,7 +15429,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountBankAccountsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -15579,7 +15579,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountCapabilitiesQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -15665,7 +15665,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountCapabilitiesCapabilityQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -15801,7 +15801,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -16043,7 +16043,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountExternalAccountsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -16253,7 +16253,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -16606,7 +16606,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPeoplePersonQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -16872,7 +16872,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -17225,7 +17225,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAccountsAccountPersonsPersonQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -17547,7 +17547,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -17734,7 +17734,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplePayDomainsDomainQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -17812,7 +17812,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -17895,7 +17895,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesFeeRefundsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18020,7 +18020,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getApplicationFeesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18150,7 +18150,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18294,7 +18294,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18480,7 +18480,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getAppsSecretsFindQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18546,7 +18546,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18616,7 +18616,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18698,7 +18698,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceHistoryIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18776,7 +18776,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -18864,7 +18864,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBalanceTransactionsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -19038,7 +19038,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -19174,7 +19174,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingMetersIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -19361,7 +19361,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -19507,7 +19507,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -19729,7 +19729,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getBillingPortalConfigurationsConfigurationQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -20134,7 +20134,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -20326,7 +20326,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -20407,7 +20407,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -20622,7 +20622,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeDisputeQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -20908,7 +20908,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -21067,7 +21067,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getChargesChargeRefundsRefundQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -21204,7 +21204,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -22303,7 +22303,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCheckoutSessionsSessionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -22491,7 +22491,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -22578,7 +22578,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -22708,7 +22708,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateOrdersOrderQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -22899,7 +22899,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -22981,7 +22981,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateProductsProductQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23047,7 +23047,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23129,7 +23129,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getClimateSuppliersSupplierQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23196,7 +23196,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getConfirmationTokensConfirmationTokenQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23265,7 +23265,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23343,7 +23343,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCountrySpecsCountryQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23420,7 +23420,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23616,7 +23616,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCouponsCouponQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23751,7 +23751,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -23925,14 +23925,14 @@ export function createRouter(implementation: Implementation): KoaRouter { email_type: z.enum(["credit_note", "none"]).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), invoice: z.string().max(5000), lines: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -24039,7 +24039,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -24047,7 +24047,7 @@ export function createRouter(implementation: Implementation): KoaRouter { limit: z.coerce.number().optional(), lines: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -24170,7 +24170,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -24255,7 +24255,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCreditNotesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -24523,7 +24523,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -24817,7 +24817,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -24960,7 +24960,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -25215,7 +25215,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -25373,7 +25373,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -25527,7 +25527,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -25783,7 +25783,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerBankAccountsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26020,7 +26020,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26271,7 +26271,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCardsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26438,7 +26438,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerCashBalanceQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26571,7 +26571,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26663,7 +26663,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26799,7 +26799,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerDiscountQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -26942,7 +26942,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -27074,7 +27074,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -27148,7 +27148,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -27405,7 +27405,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerSourcesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -27636,7 +27636,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -28201,7 +28201,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -28786,7 +28786,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -28863,7 +28863,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29137,7 +29137,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getCustomersCustomerTaxIdsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29213,7 +29213,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29292,7 +29292,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getDisputesDisputeQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29510,7 +29510,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29596,7 +29596,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEntitlementsActiveEntitlementsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29667,7 +29667,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -29806,7 +29806,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEntitlementsFeaturesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30057,7 +30057,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30066,7 +30066,7 @@ export function createRouter(implementation: Implementation): KoaRouter { type: z.string().max(5000).optional(), types: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30140,7 +30140,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getEventsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30202,7 +30202,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30280,7 +30280,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getExchangeRatesRateIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30357,7 +30357,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30484,7 +30484,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFileLinksLinkQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30619,7 +30619,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30780,7 +30780,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFilesFileQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30848,7 +30848,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -30935,7 +30935,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsAccountsAccountQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31078,7 +31078,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31447,7 +31447,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsSessionsSessionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31520,7 +31520,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31621,7 +31621,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getFinancialConnectionsTransactionsTransactionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31704,7 +31704,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31854,7 +31854,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getForwardingRequestsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -31932,7 +31932,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -32020,7 +32020,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIdentityVerificationReportsReportQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -32102,7 +32102,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -32269,7 +32269,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIdentityVerificationSessionsSessionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -32563,7 +32563,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -32784,7 +32784,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoiceitemsInvoiceitemQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -32975,7 +32975,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -33910,7 +33910,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoicesSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -34137,13 +34137,13 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), invoice_items: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -34457,7 +34457,7 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), subscription_items: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ billing_thresholds: z @@ -34718,13 +34718,13 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), invoice_items: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ amount: z.coerce.number().optional(), @@ -35040,7 +35040,7 @@ export function createRouter(implementation: Implementation): KoaRouter { .optional(), subscription_items: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array( z.object({ billing_thresholds: z @@ -35227,7 +35227,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getInvoicesInvoiceQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -35871,7 +35871,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -36555,7 +36555,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -36641,7 +36641,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingAuthorizationsAuthorizationQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -36909,7 +36909,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -38028,7 +38028,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingCardholdersCardholderQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -39145,7 +39145,7 @@ export function createRouter(implementation: Implementation): KoaRouter { exp_year: z.coerce.number().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -40241,7 +40241,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingCardsCardQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -41338,7 +41338,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -41658,7 +41658,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingDisputesDisputeQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42023,14 +42023,14 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), limit: z.coerce.number().optional(), lookup_keys: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(200)), ) .optional(), @@ -42191,7 +42191,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42362,7 +42362,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42449,7 +42449,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingPhysicalBundlesPhysicalBundleQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42521,7 +42521,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingSettlementsSettlementQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42656,7 +42656,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42735,7 +42735,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingTokensTokenQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42873,7 +42873,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -42959,7 +42959,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getIssuingTransactionsTransactionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -43169,7 +43169,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getLinkAccountSessionsSessionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -43242,7 +43242,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -43324,7 +43324,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getLinkedAccountsAccountQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -43456,7 +43456,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -43602,7 +43602,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getMandatesMandateQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -43680,7 +43680,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -44765,7 +44765,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentIntentsSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -44853,7 +44853,7 @@ export function createRouter(implementation: Implementation): KoaRouter { client_secret: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -47261,7 +47261,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -47869,7 +47869,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentLinksPaymentLinkQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -48480,7 +48480,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -48568,7 +48568,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -48996,7 +48996,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodConfigurationsConfigurationQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -49423,7 +49423,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -49560,7 +49560,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodDomainsPaymentMethodDomainQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -49755,7 +49755,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -50203,7 +50203,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPaymentMethodsPaymentMethodQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -50509,7 +50509,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -50640,7 +50640,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPayoutsPayoutQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -50890,7 +50890,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -51108,7 +51108,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPlansPlanQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -51242,14 +51242,14 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), limit: z.coerce.number().optional(), lookup_keys: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -51463,7 +51463,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPricesSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -51544,7 +51544,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPricesPriceQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -51713,13 +51713,13 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), ids: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -51909,7 +51909,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52040,7 +52040,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52188,7 +52188,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52387,7 +52387,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getProductsProductFeaturesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52466,7 +52466,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52611,7 +52611,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getPromotionCodesPromotionCodeQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52743,7 +52743,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -52995,7 +52995,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuoteQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -53351,7 +53351,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -53505,7 +53505,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -53589,7 +53589,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getQuotesQuotePdfQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -53667,7 +53667,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -53753,7 +53753,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -53833,7 +53833,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -54029,7 +54029,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRadarValueListItemsItemQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -54108,7 +54108,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -54311,7 +54311,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRadarValueListsValueListQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -54448,7 +54448,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -54586,7 +54586,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getRefundsRefundQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -54770,7 +54770,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -55559,7 +55559,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReportingReportRunsReportRunQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -55622,7 +55622,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReportingReportTypesQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -55702,7 +55702,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReportingReportTypesReportTypeQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -55780,7 +55780,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -55856,7 +55856,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getReviewsReviewQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -55987,7 +55987,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -56076,7 +56076,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -56650,7 +56650,7 @@ export function createRouter(implementation: Implementation): KoaRouter { client_secret: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -57822,7 +57822,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -57983,7 +57983,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getShippingRatesShippingRateTokenQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58130,7 +58130,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58215,7 +58215,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58436,7 +58436,7 @@ export function createRouter(implementation: Implementation): KoaRouter { client_secret: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58644,7 +58644,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58722,7 +58722,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58815,7 +58815,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -58948,7 +58948,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -59195,7 +59195,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionItemsItemQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -59374,7 +59374,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -59569,7 +59569,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -59935,7 +59935,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionSchedulesScheduleQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -60442,7 +60442,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -60927,7 +60927,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionsSearchQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -61095,7 +61095,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -61915,7 +61915,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(500).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -62007,7 +62007,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -62467,7 +62467,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxRegistrationsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -62596,7 +62596,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxSettingsQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -62851,7 +62851,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxTransactionsTransactionQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -62919,7 +62919,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(500).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63011,7 +63011,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63087,7 +63087,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxCodesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63149,7 +63149,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63411,7 +63411,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxIdsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63485,7 +63485,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63635,7 +63635,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTaxRatesTaxRateQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -63784,7 +63784,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -64111,7 +64111,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalConfigurationsConfigurationQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -64460,7 +64460,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -64660,7 +64660,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalLocationsLocationQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -64819,7 +64819,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -65012,7 +65012,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTerminalReadersReaderQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -68484,7 +68484,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -68681,7 +68681,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTestHelpersTestClocksTestClockQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70136,7 +70136,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTokensTokenQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70220,7 +70220,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70350,7 +70350,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTopupsTopupQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70538,7 +70538,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70672,7 +70672,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70822,7 +70822,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTransfersTransferQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -70954,7 +70954,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTransfersTransferReversalsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71078,7 +71078,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71213,7 +71213,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryCreditReversalsCreditReversalQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71282,7 +71282,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71420,7 +71420,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryDebitReversalsDebitReversalQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71500,7 +71500,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71679,7 +71679,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryFinancialAccountsFinancialAccountQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -71856,7 +71856,7 @@ export function createRouter(implementation: Implementation): KoaRouter { z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72030,7 +72030,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72172,7 +72172,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryInboundTransfersIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72312,7 +72312,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72509,7 +72509,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryOutboundPaymentsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72632,7 +72632,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72786,7 +72786,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryOutboundTransfersOutboundTransferQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -72918,7 +72918,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73012,7 +73012,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedCreditsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73076,7 +73076,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73160,7 +73160,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryReceivedDebitsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73246,7 +73246,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73335,7 +73335,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryTransactionEntriesIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73410,7 +73410,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73510,7 +73510,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getTreasuryTransactionsIdQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -73576,7 +73576,7 @@ export function createRouter(implementation: Implementation): KoaRouter { ending_before: z.string().max(5000).optional(), expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), @@ -74118,7 +74118,7 @@ export function createRouter(implementation: Implementation): KoaRouter { const getWebhookEndpointsWebhookEndpointQuerySchema = z.object({ expand: z .preprocess( - (it) => (Array.isArray(it) || it === undefined ? it : [it]), + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), z.array(z.string().max(5000)), ) .optional(), 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 493ff154d..aa5c38ec5 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 @@ -174,8 +174,7 @@ export abstract class AbstractSchemaBuilder< ...parameter.schema, "x-internal-preprocess": { deserialize: { - fn: ((it: unknown) => - Array.isArray(it) || it === undefined ? it : [it]).toString(), + fn: "(it: unknown) => Array.isArray(it) || it === undefined ? it : [it]", }, }, } 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 8b40dba7e..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 @@ -112,8 +112,20 @@ export class JoiBuilder extends AbstractSchemaBuilder< schema: string, transformation: string | ((it: unknown) => unknown), ) { - // TODO: is it possible to do arbitrary transformations with `joi`? - return schema + // 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 { From 879149d0381216804b66e664c948f43e35cc1f75 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 10:33:42 +0100 Subject: [PATCH 08/10] fix: reduce diff --- packages/typescript-koa-runtime/src/zod.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/typescript-koa-runtime/src/zod.ts b/packages/typescript-koa-runtime/src/zod.ts index 930c486c5..87b1971de 100644 --- a/packages/typescript-koa-runtime/src/zod.ts +++ b/packages/typescript-koa-runtime/src/zod.ts @@ -7,10 +7,6 @@ export type Params = { body: Body } -function isZodSchema(z: unknown): z is z.ZodTypeAny { - return typeof z === "object" && z !== null && Reflect.has(z, "parse") -} - export function parseRequestInput( schema: Schema, input: unknown, From b05b1c46a6f7f4f9e89f87327a507e7338e4d993 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 10:48:30 +0100 Subject: [PATCH 09/10] fix: support $ref --- integration-tests-definitions/todo-lists.yaml | 22 ++++++++++++++----- .../todo-lists.yaml/client.service.ts | 13 ++++++++--- .../src/generated/todo-lists.yaml/models.ts | 2 ++ .../src/generated/todo-lists.yaml/client.ts | 11 +++++++--- .../src/generated/todo-lists.yaml/models.ts | 2 ++ .../src/generated/todo-lists.yaml/client.ts | 16 +++++++++++--- .../src/generated/todo-lists.yaml/models.ts | 2 ++ .../generated/todo-lists.yaml/generated.ts | 20 +++++++++++++++-- .../src/generated/todo-lists.yaml/models.ts | 5 ++++- .../src/generated/todo-lists.yaml/schemas.ts | 2 ++ .../src/core/openapi-types-normalized.ts | 2 ++ .../src/core/openapi-types.ts | 1 + .../abstract-schema-builder.ts | 18 ++++++++++----- 13 files changed, 92 insertions(+), 24 deletions(-) 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/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/packages/openapi-code-generator/src/core/openapi-types-normalized.ts b/packages/openapi-code-generator/src/core/openapi-types-normalized.ts index 941b60bbb..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 } diff --git a/packages/openapi-code-generator/src/core/openapi-types.ts b/packages/openapi-code-generator/src/core/openapi-types.ts index 2548ebb28..a81374db3 100644 --- a/packages/openapi-code-generator/src/core/openapi-types.ts +++ b/packages/openapi-code-generator/src/core/openapi-types.ts @@ -278,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 aa5c38ec5..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 @@ -164,12 +164,9 @@ export abstract class AbstractSchemaBuilder< model.required.push(parameter.name) } - // TODO: support $ref properly - if ( - parameter.in === "query" && - !isRef(parameter.schema) && - parameter.schema.type === "array" - ) { + const dereferenced = this.input.loader.schema(parameter.schema) + + if (parameter.in === "query" && dereferenced.type === "array") { model.properties[parameter.name] = { ...parameter.schema, "x-internal-preprocess": { @@ -209,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) { From 001aaaa702f802d601bb70c60486ba9a7e42249f Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Sat, 27 Jul 2024 11:09:43 +0100 Subject: [PATCH 10/10] fix: add simple todo-list server for testing --- .../src/petstore-expanded.yaml.ts | 2 +- .../typescript-koa/src/todo-lists.yaml.ts | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 integration-tests/typescript-koa/src/todo-lists.yaml.ts 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) + }) +}