Expose arguments of MissingPropertiesException#119
Expose arguments of MissingPropertiesException#119jakewtaylor wants to merge 1 commit intobeacon-hq:mainfrom
Conversation
Currently when receiving a MissingPropertiesException, it's difficult to show descriptive validation messages to a user when using Bags as request validation. This commit exposes the 2 inputs to `MissingPropertiesException` so one can read _which_ parameters were missing.
|
To be honest this might be worth a bit of discussion, too. First off; love this package, really nice way to handle DTOs in my opinion, love the type safety and simplicity! The docs say:
But unless I'm missing something, trying to actually replace Laravel's FormRequests is proving a little tricky; I'm not getting validation errors back, I'm getting 500 errors, due to Am I missing some simple way of handling these things? For what it's worth, I'm using this with Inertia in Laravel, which might be adding to my confusion here... If this kind of thing should work out of the box, I'd love some examples of how to wire things up properly! |
|
Not to "+1", but... I ended up on this issue for exactly these lines:
Strongly agree with Jake, love the package, fantastic way to annotate DTOs with type information. But the juggling and interoperability with Inertia in particular is a bit of a show stopper. |
|
@chrisk-7777 for what it's worth, I've decided to continue using Laravel's default form request validation, but have been making corresponding bag classes for each request, and adding a i.e. public function store(CreateRequest $request, CreateAction $action) {
// get a Bag class representing the request
$input = $request->toBag();
// the action class works with the bag so doesn't need to be aware of the original request at all
$result = $action->handle($input);
// etc
}Seems to be working fairly well for me so far 👍 Perhaps the |
Currently when receiving a MissingPropertiesException, it's difficult to show descriptive validation messages to a user when using Bags as request validation.
This commit exposes the 2 inputs to
MissingPropertiesExceptionso one can read which parameters were missing.