Hypersequent/zen

Any option to skip certain validation?

Closed this issue · 3 comments

Hi, thanks for this package!

Does it have any option to skip certain validations from the go validator?

for example, I have this type definition in go

type SomeType struct {
   Name        string `json:"name"`
   Image        string `json:"image" validate:"uri"`
}

currently, it doesn't allow me to convert into TS and gives this error message panic: unknown validation: uri
I assume it's because Zod doesn't support uri validation?

I want to make it ignore the validation part and leave it without validation for this specific attribute, as below

export const SomeStructSchema = z.object({
  name: z.string(),
  image: z.string(),
});

any idea how I can do that?

Hi, I have solved this problem by creating a fork and adding an ignore list in my repo
thanks a lot!

@nafalabi Hey sorry we didn't get to you earlier, could you make a PR. We will happy to merge it.

Possible options are

  • Provide a list of validations as input which we can ignore (probably what you did)
  • Print warnings instead of panics

Hi @satvik007 yes sure thing!