Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Laravel - Validate input body is a list

$
0
0

I'm trying to write a validation in Laravel 11 for a POST call which passes a list of objects like this

[{"id": 1, "name": "One"}, {"id": 2, "name": "Two"}]

All documentation I've found explains how to validate a list if it's a sub-object, as {"list": [{"id": 1, "name": "One"}, {"id": 2, "name": "Two"}]}, but this api expects the data root to be the list, invalidating this attempts.


Viewing all articles
Browse latest Browse all 3637

Trending Articles