You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Data structure validation is something that is very important on Assemblyline's frontend since having the wrong structure or not having the right property will crash the app if its not handled properly. Right now, we use Typescript to validate the data, but it only works during development and not during runtime. Also, the data models are defined in the components that uses them which means that there are multiple definitions of the same data structure in multiple components that share the same definition (or they import the definition from another component which increases the coupling that we want to reduce as much as possible).
Describe the solution you'd like
Just like how Assemblyline's backend has a centralized section for the ODM to define all the models and to validate the data structure, I would like to do the same on the frontend. I propose that we use the library called Zod to manage all the models the frontend uses in a folder called "/models". From what I saw, it is well integrated into Typescript and serves a similar purpose. Whereas Typescript defines the data structure only during development, Zod being JavaScript ensure the data has the right definition during the run time by parsing them.
Describe alternatives you've considered
We could just centralize the Typescript model definition, but having Zod would simplify the whole data validation part.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Data structure validation is something that is very important on Assemblyline's frontend since having the wrong structure or not having the right property will crash the app if its not handled properly. Right now, we use Typescript to validate the data, but it only works during development and not during runtime. Also, the data models are defined in the components that uses them which means that there are multiple definitions of the same data structure in multiple components that share the same definition (or they import the definition from another component which increases the coupling that we want to reduce as much as possible).
Describe the solution you'd like
Just like how Assemblyline's backend has a centralized section for the ODM to define all the models and to validate the data structure, I would like to do the same on the frontend. I propose that we use the library called Zod to manage all the models the frontend uses in a folder called "/models". From what I saw, it is well integrated into Typescript and serves a similar purpose. Whereas Typescript defines the data structure only during development, Zod being JavaScript ensure the data has the right definition during the run time by parsing them.
Describe alternatives you've considered
We could just centralize the Typescript model definition, but having Zod would simplify the whole data validation part.
The text was updated successfully, but these errors were encountered: