ShopApiPlugin
ShopApiPlugin copied to clipboard
Controllers missing proper validation of provided data
Problem
Some controllers currently missing proper validation with the Symfony validator component. This results in uncaught exceptions from the Assert
s in the handlers which will end in a 500
error as a response.
Solution
A correct example with Symfony validator validation in place: https://github.com/Sylius/ShopApiPlugin/blob/master/src/Controller/Cart/AddCouponAction.php#L51-L57
An example of a controller that's lacking proper validation before triggering the bus: https://github.com/Sylius/ShopApiPlugin/blob/master/src/Controller/Checkout/ChoosePaymentMethodAction.php
This makes the REST API rather difficult to use as it's not clear what went wrong during the request.
Endpoints with missing validations are:
Cart
- [ ] AssignCustomerToCartRequest
Checkout
- [ ] AddressOrderRequest
- [x] ChoosePaymentMethodRequest
- [ ] ChooseShippingMethodRequest
Customer
- [x] SendResetPasswordTokenRequest
- [x] GenerateResetPasswordTokenRequest
edited by mamazu to track a list of requests that don't have validation
You are completely right this should be fixed.
This is still an issue for the checkout process. However the complete checkout action is now done.
I think ResetPassword Endpoint handled is this PR