diff --git a/packages/zod-nestjs/src/lib/create-zod-dto.ts b/packages/zod-nestjs/src/lib/create-zod-dto.ts index 3b87630..1f773c0 100644 --- a/packages/zod-nestjs/src/lib/create-zod-dto.ts +++ b/packages/zod-nestjs/src/lib/create-zod-dto.ts @@ -61,6 +61,7 @@ export type ZodDtoStatic = { // Used for transforming the SchemaObject in _OPENAPI_METADATA_FACTORY type SchemaObjectForMetadataFactory = Omit & { required: boolean | string[]; + isArray?: boolean; }; export const createZodDto = ( @@ -148,6 +149,10 @@ export const createZodDto = ( convertedSchemaObject.type = 'string'; // There ist no explicit null value in OpenAPI 3.0 convertedSchemaObject.nullable = true; } + // Array handling (NestJS references 'isArray' boolean) + if (convertedSchemaObject.type === 'array') { + convertedSchemaObject.isArray = true; + } // Exclusive minimum and maximum const { exclusiveMinimum, exclusiveMaximum } = schemaObject; if (exclusiveMinimum !== undefined) {