Validate a nested array of objects GET query parameter using a DTO & class-validator in NestJS

Sometimes, the smallest things take up quite a bit of time. This time, it was a simple serialisation issue.

Validate a nested array of objects GET query parameter using a DTO & class-validator in NestJS
Photo by Fabrizio Frigeni / Unsplash

Sending an array of objects as a GET request's query parameters using axios from the frontend to a NestJS backend, I ended up with an error:

"constraints":{"nestedValidation":"each value in nested property byRelationships must be either object or array"}

Backend-side