-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Insufficent validation for city field #2653
Comments
Related to #2578 |
Hey @lukeromanowicz - You've just recently modified these schemas, would You take care of this one? |
@pkarw
Of course, we can also simply add the same validation on the frontend as it is in middleware ending up with 3 places of order validation (front, middleware and backend). Which way do we choose? |
The most of the validation should take place in the front end plus we should display better validation msgs from the server side I belive - mix of 1+2 from Your proposal I mean - we’re offline first platform so we can’t allow the user to relying only on server side validation. However when we’re online and server returns error we should properly display them Unfortunately magento api methods return only single error strings so it would be very hardness to achieve this behavior without writing native magento2 module that we like to avoid. So I belive we can just add the same validation in the middleware like we have in the front end and then if magento returns error we can and should just display it in the notification (this is already taking place) We probably just need to align the validation rules at this point plus maybe display the AJV errors better way in the front end (currently there is just a shot msg on internal validation error without the details) |
@lukeromanowicz would be awesome to have this done till 1.9 |
@pkarw it's not possible to implement UTF-8 complainant solution the right way until babel/babel#9892 is resolved. All we can do for now is to add polyfills for that on our own. |
Closing with related #2771 |
Related issue
#2317
Steps to reproduce the issue
Current behavior
Expected behavior
Validation on the front should match backend reqirements
OR
Front error message should point to the problem
500 response:
{"code":500,"result":[{"keyword":"pattern","dataPath":".addressInformation.shippingAddress.city","schemaPath":"#/properties/addressInformation/properties/shippingAddress/properties/city/pattern","params":{"pattern":"[a-zA-Z]+"},"message":"should match pattern "[a-zA-Z]+""}]}
Repository
demo.stroefrontcloud.io
Can you handle fixing this bug by yourself?
Which Release Cycle state this refers to? Info for developer.
Pick one option.
hotfix
ormaster
branch and create Pull Request4. Hotfix
back tohotfix
.Additional information
For many reasons, city field should accept digits. But in case ONLY digits were placed into that field, a problem occurs. This might look a bit like edge case, but it's quite possible for customer to accidentally input street number or zip code into city field. In that case, error message wont show him, what is wrong
The text was updated successfully, but these errors were encountered: