Skip to content

Add schema validator when sending or receiving requests #479

Open
@smartspot2

Description

@smartspot2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomersjavascriptPull requests that update Javascript code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions