Expose arguments of MissingPropertiesException
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:
Bag can automatically inject Bag objects into your controllers using Laravel's automatic dependency injection. This can take the place of using Laravel's form request validation and accessing the input data.
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 MissingPropertiesException when fields are omitted, or ValueError when using the Enum validator/cast with invalid values etc.
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:
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 MissingPropertiesException when fields are omitted, or ValueError when using the Enum validator/cast with invalid values etc. For what it's worth, I'm using this with Inertia in Laravel, which might be adding to my confusion here...
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.