chrishoermann / zod-prisma-types

Generator creates zod types for your prisma models with advanced validation
Other
661 stars 50 forks source link

[Feature Request] Support node subpath Import statements (import statements starting with #) #270

Open alexblazevski opened 3 months ago

alexblazevski commented 3 months ago

Is your feature request related to a problem? Please describe. I'm using nodejs imports in my repo: https://nodejs.org/api/packages.html#imports, which mean that the imports start with #.

Say i have the following model:

/// @zod.import(["import { myFunction } from '#functions/myFunction'"])
model RandomModel {
  randomField                    String /// @zod.custom.use(myFunction)
}

When i try to generate, i get this error:

[@zod generator error]: import statement is not valid. Check for unusal characters. [Error Location]: Model: 'RandomModel'.

Describe the solution you'd like Id like to be able to use imports that start with a #. I assume the # character needs to be whitelisted from whatever check is being done on the import statements

Thanks :)