-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Slightly looser validation in dev-mode #20974
Comments
@ampproject/wg-caching This would be very dangerous. There may be existing AMP Caches that assume that the validator passing is sufficient to assume certain things about the document. Existing users of the AMP Validator would need to add additional validation that A few possible alternative ideas that wouldn't have this risk:
I'm leaning towards 2. Both alternatives require changes to development environments that want to support this feature, rather than changes to all production environments which don't. |
From our standpoint we can make any needed changes in Next.js's dev environment to opt-in to the behavior 🙏 |
To generalize this to more than just script tags (in case that becomes interesting):
This causes validation to still fail but is easily inspected and also extensible to any tag that needs to do something it normally wouldn't. [1] Type identifiers sit on the |
+1 for "technically failing validation but displaying it as passing for development mode". I also strongly support making the dev environments do the work (of which there are zero right now), and staying on the safe side for existing users. Generalizing to other elements might make sense. I just wanted to keep the scope controlled. |
Hi there, team! The Next.js team is getting occasional issues from users asking why their apps don't pass AMP validation in development (e.g. vercel/next.js#8050). Is this planned for prioritization in the near future? Are there any resources the Next.js team could offer to help? |
No updates as of yet. It's currently a P3, but I've also just marked it for our next fixit sprint. |
Awesome @Gregable 💯 |
Fixed. You can see how this works here: The requirement is that you add
This causes validation to fail, but the error code should hopefully be easy to match against and filter out downstream of the validator. Once you do this, any other tag that you add Errors are only suppressed. The computation from the given tag is still carried through. This means that, for example, you will not get errors about not using an included extension if you mark the usage with Feel free to reopen if this doesn't meet your needs and we can tweak as needed. |
Awesome @Gregable! Will have my team implement 👍 |
After consultation with @kristoferbaxter we will change the attribute from |
The attribute is now |
Will the AMP Validator extension be updated to handle this special case? Currently I see: It would be useful if the icon would show a warning symbol similar to when a deprecation issue is present, or else a separate debug icon? This would be very helpful when the only validator error is just |
@westonruter I think the default behavior should be that this is treated as an error. Should the extension have special casing for this? I can see the argument for it, but I also don't know that it should hide the issue. The one risk is that a publisher forgets to "fix" this issue in production, after using it to debug in test and the extension fails to alert them to that. The "separate debug icon" seems like it could be a good recommendation. Would you file a separate issue for that suggestion? |
Done! See #24176. |
Allow non-AMP script tags in the JS validator if the
development-mode-only
attribute is present on thescript
tag.This is for development environments that may want to run additional code (e.g. to do hot-reloading on code changes) while otherwise being compatible with AMP tools that do validation.
CC @timneutkens @sebastianbenz
The text was updated successfully, but these errors were encountered: