From eeaf6f39a7efd0ea472564fe072f334e374404fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Gonz=C3=A1lez?= Date: Sun, 16 Nov 2025 14:31:28 -0600 Subject: [PATCH] zod null, too --- CHANGELOG.md | 6 ++++++ packages/nestjs-endpoints/src/endpoint-fn.ts | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d64c1..6c38934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.0.3 (2025-11-16) + +## Bug fixes + +- Disallow both ZodNull and ZodNullable types for output + ## 2.0.2 (2025-11-16) ### Bug fixes diff --git a/packages/nestjs-endpoints/src/endpoint-fn.ts b/packages/nestjs-endpoints/src/endpoint-fn.ts index b5ecccf..7d9227e 100644 --- a/packages/nestjs-endpoints/src/endpoint-fn.ts +++ b/packages/nestjs-endpoints/src/endpoint-fn.ts @@ -16,7 +16,7 @@ import { } from '@nestjs/common'; import { HttpAdapterHost } from '@nestjs/core'; import { ApiBody, ApiOperation, ApiResponse } from '@nestjs/swagger'; -import { z, ZodNullable, ZodType } from 'zod'; +import { z, ZodNull, ZodNullable, ZodType } from 'zod'; import { settings } from './consts'; import { ZodSerializationException, @@ -273,7 +273,9 @@ export function endpoint< * }) * ``` */ - output?: OutputSchema extends ZodNullable ? never : OutputSchema; + output?: OutputSchema extends ZodNull | ZodNullable + ? never + : OutputSchema; /** * Inject controller providers at class instance level. *