zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Feature Request] Extensibility for Custom Validation Attributes in Zmodel.

Open mishodzuliashvili opened this issue 1 year ago • 0 comments

Feature Request: Extensibility for Custom Validation Attributes in Zmodel

Context: In my project, I needed to validate phone numbers using a custom Zod schema. While I was able to do this manually by refining the generated Zod schemas, it would be beneficial to have built-in extensibility in Zmodel for custom validation attributes like @phoneNumber.

Problem: Currently, Zmodel does not allow for custom validation attributes, making it difficult to handle specific validation logic like phone number validation across both frontend and backend seamlessly.

Proposed Solution: Introduce a mechanism in Zmodel that allows developers to define custom validation attributes, such as @phoneNumber, that can be used in the model definitions and automatically integrated into the generated Zod schemas.

Benefits:

  • Streamline validation across frontend and backend.
  • Reduce the need for manual refinement of schemas.
  • Improve developer experience by reducing repetitive code.

Additional Context: I discussed this with one of your team members, and they mentioned that this functionality is not yet available but would be a great addition in the future.

Thank you for considering this feature request!

mishodzuliashvili avatar Aug 23 '24 16:08 mishodzuliashvili