Closed GautierDele closed 1 year ago
Hi are you able to give me an example on how to find out why I get 422 (Unprocessable Content)
?
I have encountered this many time so far. My only option is to just fiddle and hope I get it to work as I have no idea why I get this.
As an example, right now when I add a relation to the data json I get 422 (Unprocessable Content)
let data = {
"filters": [
{"field": "id", "operator": "=", "value": debtor_id},
],
"includes": [
{
"relation": "priceList",
},
],
}
If I take includes
away it just works.
I have confirmed the relationship is set up in Laravel using a traditional request.
In the repsonse tab in devtools I see the folloiwng error "The selected includes.0.relation is invalid."
Edit:
Ok I am good now. I was not aware that I needed to also create a Resourse and Controller for the priceList
relation. The new resourse also needed the feilds array to be populated. and the relations then stated in the Resourse that I was requesting a relationship from i.e. Entities needed the relations to be stated
public function relations(\Lomkit\Rest\Http\Requests\RestRequest $request): array
{
return [
HasOne::make('priceList', PriceListResource::class),
];
}
Description
Many errors keys doesn't fully provide the path but the message does. This is due to using rules class.
For example: