diff --git a/packages/generator/package.json b/packages/generator/package.json index 342dfc49..d8bb2b72 100644 --- a/packages/generator/package.json +++ b/packages/generator/package.json @@ -1,6 +1,6 @@ { "name": "zod-prisma-types", - "version": "2.5.4", + "version": "2.5.5", "description": "Generates zod schemas from Prisma models with advanced validation", "author": "Chris Hörmann", "license": "MIT", diff --git a/packages/generator/src/constants/objectMaps.ts b/packages/generator/src/constants/objectMaps.ts index bd1a48f8..3f3abf87 100644 --- a/packages/generator/src/constants/objectMaps.ts +++ b/packages/generator/src/constants/objectMaps.ts @@ -27,6 +27,7 @@ import { ///////////////////////////////////////////////// /** + * @deprecated * Map all `validators` that can be used in the documentation of the prisma.schema * to the prisma scalar types on which this `validator` is allowed. * @@ -82,6 +83,9 @@ export const PRISMA_TO_ZOD_TYPE_MAP: Record< // ZOD VALID ERROR KEYS ///////////////////////////////////////////////// +/** + * @deprecated + */ export const ZOD_VALID_ERROR_KEYS: ZodCustomErrorKey[] = [ 'invalid_type_error', 'required_error', @@ -92,16 +96,23 @@ export const ZOD_VALID_ERROR_KEYS: ZodCustomErrorKey[] = [ // REGEX MAPS ///////////////////////////////////////////// +/** + * @deprecated + */ export type ValidatorMapValue = | RegExp | ((pattern: string) => string | undefined); +/** + * @deprecated + */ export type ValidatorMap = Record< TKeys, ValidatorMapValue >; /** + * @deprecated * Maps the right regex to the right validator key. * * Used to determine if a validator key is valid for a `string` type. @@ -126,6 +137,7 @@ export const STRING_VALIDATOR_REGEX_MAP: ValidatorMap = }; /** + * @deprecated * Maps the right regex to the right validator key. * * Used to determine if a validator key is valid for a `number` type. @@ -149,6 +161,7 @@ export const NUMBER_VALIDATOR_REGEX_MAP: ValidatorMap = }; /** + * @deprecated * Maps the right regex to the right validator key. * * Used to determine if a validator key is valid for a `date` type. @@ -160,6 +173,9 @@ export const DATE_VALIDATOR_REGEX_MAP: ValidatorMap = { max: DATE_VALIDATOR_NUMBER_AND_MESSAGE_REGEX, }; +/** + * @deprecated + */ export const CUSTOM_VALIDATOR_REGEX_MAP: ValidatorMap = { use: (pattern) => { diff --git a/packages/usage/prisma/schema.prisma b/packages/usage/prisma/schema.prisma index 765a02c5..fe40ef67 100644 --- a/packages/usage/prisma/schema.prisma +++ b/packages/usage/prisma/schema.prisma @@ -90,7 +90,7 @@ model ModelWithComments { // It should not matter if the comments are above or next to the field /// comment line one -/// @zod.import(["import { myFunction } from "../../../../utils/myFunction";", "import validator from 'validator';"]) +/// @zod.import(["import { myFunction } from "../../../../utils/myFunction";", "import validator from 'validator';", "import some from "my-package";"]) /// comment line two model MyPrismaScalarsType { /// @zod.string({ invalid_type_error: "some error with special chars: some + -*#'substring[]*#!§$%&/{}[]", required_error: "some other", description: "some description" }).cuid()