diff --git a/decorators.ts b/decorators.ts index 52ee058..a4cbd90 100644 --- a/decorators.ts +++ b/decorators.ts @@ -2,7 +2,15 @@ import { NotValidBodyException, createParamDecorator, OptionsResolver, type Exec import { z } from "zod"; import { MetadataHelper } from '@danet/core/metadata'; -export const zodSchemaKey = 'zodSchema' +/** + * Constant to access body zod schema for metadata + */ +export const zodBodySchemaKey = 'zodBodySchema' + +/** + * Constant to access query zod schema for metadata + */ +export const zodQuerySchemaKey = 'zodQuerySchema' /** * Get request's body or a given property and validate it with the provided Zod Schema. Throws NotValidBodyException @@ -34,7 +42,7 @@ export function Body(zodSchema: z.ZodObject, prop?: return param; }, (target, propertyKey) => { MetadataHelper.setMetadata( - zodSchemaKey, + zodBodySchemaKey, zodSchema, target.constructor, propertyKey, @@ -56,7 +64,7 @@ export function Query(zodSchema: z.ZodObject): Decor return param; }, (target, propertyKey) => { MetadataHelper.setMetadata( - zodSchemaKey, + zodQuerySchemaKey, zodSchema, target.constructor, propertyKey, diff --git a/deno.json b/deno.json index e1c5ef8..5315227 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@danet/zod", - "version": "0.0.4", + "version": "0.0.5", "exports": { ".": "./decorators.ts" },