Add schema validator when sending or receiving requests #479
Labels
enhancement
New feature or request
good first issue
Good for newcomers
javascript
Pull requests that update Javascript code
When we send data to the Django server or receive data from the Django server, we currently have no way of actually ensuring that the data is of the correct format.
Adding a schema validator can give us this insurance, while also making it very explicit what data types we're passing around are. Further, this allows for clearer documentation on the actual data being passed around between the frontend and backend. The most popular validator used with React/TS is Zod.
We should update all of our queries to include Zod as a preprocessing step, migrating the types to use Zod schemas (with types inferred from them). Other components shouldn't need to be modified, since all of this validation should be done within the custom react-query hooks, and the same data is passed to other components. Some imports may need to be changed though, to align with the potentially new locations for the Zod schemas.
The text was updated successfully, but these errors were encountered: