Currently the database queries are done using ORM and then converting the database response to a normal Javascript object via doing countless maps and _.get({plain:true}) calls.
This often leads to problems that are hard to notice. For example the following code from fetching event details as an admin produces responses not matching the schema:
The problem here is that the signup.answers! is actually a foreign key lookup and the items of that answers! array are still the ORM wrapped objects.
The fix is quite simple:
The problem still remains quite annoying and I see it making it harder to onboard people to the project and takes quite some skill to figure out what's wrong here since with the current setup the schema validation only gives the last nested field name in the error message and not the full path to the point in JSON where the data was invalid :D
Currently the database queries are done using ORM and then converting the database response to a normal Javascript object via doing countless
map
s and_.get({plain:true})
calls.This often leads to problems that are hard to notice. For example the following code from fetching event details as an admin produces responses not matching the schema:
The problem here is that the
signup.answers!
is actually a foreign key lookup and the items of thatanswers!
array are still the ORM wrapped objects.The fix is quite simple:
The problem still remains quite annoying and I see it making it harder to onboard people to the project and takes quite some skill to figure out what's wrong here since with the current setup the schema validation only gives the last nested field name in the error message and not the full path to the point in JSON where the data was invalid :D