Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Using a Data Validation library such as Zod #176

Open
cccs-nr opened this issue Jan 18, 2024 · 0 comments
Open

Feature Request: Using a Data Validation library such as Zod #176

cccs-nr opened this issue Jan 18, 2024 · 0 comments
Assignees
Labels
assess We still haven't decided if this will be worked on or not enhancement New feature or request

Comments

@cccs-nr
Copy link

cccs-nr commented Jan 18, 2024

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.

@cccs-nr cccs-nr added enhancement New feature or request assess We still haven't decided if this will be worked on or not labels Jan 18, 2024
@cccs-nr cccs-nr self-assigned this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assess We still haven't decided if this will be worked on or not enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant