-
Notifications
You must be signed in to change notification settings - Fork 385
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
Expose reason for why a validation error is raised #1420
Comments
Related #1360. |
@westonruter - Thanks for the suggestion. This is closely related (duplicate?) To AC2 of #1364. A few questions:
|
Question About Not Including In Beta Release Hi @postphotos, And you were right that this was part of even the earlier designs. But would you mind if we delayed this until for after the next Beta release, so that we've had time to iron out the exact error messages? Thanks, Leo |
It's not quite a duplicate. This issue is more for the underlying plumbing to get the information to surface. It's not about showing it per se. The reason could be stored in the validation error properties under a |
A reason could be |
Moving Off v1.0 Board If it's alright, I'm moving this off of the |
This comment has been minimized.
This comment has been minimized.
It would be great to have strings a-la Lighthouse audit results, providing information/advice in the context of each error type. |
I've started prototyping this. |
@schlessera points point, as part of this and #3730, we should capture the validation error messages and wrap them in translation functions as part of the spec PHP generator process, so that the strings can all be translated in WordPress. |
With #4401 these error messages (titles) are also displayed in the block editor warnings. |
When there is a validation error causing an element such as the following to be removed:
<link rel="manifest" href="http://example.com/wp-json/app/v1/web-manifest">
There is no corresponding reason why it has been removed. The developer currently has to figure it out on their own. This us unfortunate because the plugin has the reason as part of the validation logic. So in the above example, the validation error is raised due to an illegal protocol being used. The validation error would be detected here:
https://github.com/Automattic/amp-wp/blob/b3e1b4d07dda70c5070d30f7426f849eb3a39823/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php#L983-L985
And this is due to the spec mandating the
https
protocol formanifest
links:https://github.com/Automattic/amp-wp/blob/b3e1b4d07dda70c5070d30f7426f849eb3a39823/includes/sanitizers/class-amp-allowed-tags-generated.php#L7111-L7119
We need to surface this reason when a validation error happens.
We should be reusing the same error codes (and messages) that the validator itself uses.
Compare/contrast with what the plugin is using today:
amp-wp/includes/validation/class-amp-validation-error-taxonomy.php
Lines 2872 to 2949 in 980375c
Validation Error Codes
The text was updated successfully, but these errors were encountered: