-
-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Request validation data pipe #381
Conversation
Not sure if this is correct, since we use normalizers to convert objects into arrays of data. And I don't think we want to create a pipe which does the same because that would become confusing. Maybe a beforeValidation method hook is a bit safer in this context where you pass in all the properties, you would lose the benefit of having a request object, but the whole system would be consistent which is always a win in my opinion. |
It looks like Normalizers would be more appropriate 😇 . This ensures that the data is already determined at the beginning. Thanks |
Maybe there should be an optional prepareForValidation static method on In my example, this may require a new Normalizers, as I intend to use eg: class Profile extends Controller
{
public function update(UserData $data)
{
// TODO
}
} So I needed to organize my data before I noticed that when injecting directly with
This new Normalizers should be behind the |
Mhh this would probably be something breaking, since Normalizers don't have any idea about what data object they are working for and you'll need that to call the method. But I'm not against adding such thing. Maybe we should also change how the code works, at this moment when multiple payloads are provided to the from method of a data object. We run for each payload a normalizer + pipeline. It would make a lot more sense to run a normalizer on each payload merge them and then send them altogether through the pipeline. We're working on a next major release of data but it will be a few months before we can release it. That being said, you're always welcome to send in a PR doing this to the |
Overwrite the data that needs to be verified in the request. You can add a
validationData
method like FromRequest toprovide the data used to participate in the form validation