Skip to content
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

Validator: spec_url field is not supplied for every tag spec #26033

Closed
westonruter opened this issue Dec 16, 2019 · 4 comments
Closed

Validator: spec_url field is not supplied for every tag spec #26033

westonruter opened this issue Dec 16, 2019 · 4 comments

Comments

@westonruter
Copy link
Member

In the AMP WordPress plugin we want to add more linkages between the internal validation tool and amp.dev. If someone is using a component in a way that violates its validator spec, then we'd want to link the user to the docs page for that component. However, the required spec_url is not supplied for all tag specs.

For example, let's say I put an <amp-accordion> on my page and inside of it I put a <section> which contains one single <h2>. This would violate the spec. But which spec? Specifically it would be the spec with the name amp-accordion > section, and and we'd want to link the user to https://amp.dev/documentation/components/amp-accordion/

However, there is no spec_url defined for this tag spec:

tags: { # <amp-accordion> > <section>
html_format: AMP
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "SECTION"
spec_name: "amp-accordion > section"
mandatory_parent: "AMP-ACCORDION"

And so the Validator is not able to provide a “Learn More” link:

image

The spec name for amp-accordion does have a spec_url defined, however:

tags: { # <amp-accordion>
html_format: AMP
html_format: AMP4ADS
html_format: AMP4EMAIL
html_format: ACTIONS
tag_name: "AMP-ACCORDION"
requires_extension: "amp-accordion"
attrs: { name: "animate" value: "" }
attrs: {
# session-states are always disabled in AMP4EMAIL
disabled_by: "amp4email"
name: "disable-session-states"
value: ""
}
attrs: { name: "expand-single-section" value: "" }
attr_lists: "extended-amp-global"
child_tags: {
child_tag_name_oneof: "SECTION"
}
spec_url: "https://amp.dev/documentation/components/amp-accordion"

When that tag spec is violated, a “Learn More” link is provided:

image

So why is https://amp.dev/documentation/components/amp-accordion not supplied as the spec_url for the amp-accordion > section tag spec as it is done for the amp-accordion tag spec? If the spec_url were supplied for every tag spec this would facilitate providing developers with important context for why it is invalid and where they can find proper usage information.

Can all of the tag specs be updated to supply the relevant spec_url for each?

@honeybadgerdontcare
Copy link
Contributor

@westonruter we in the wg:caching team welcome PRs that improve the developer experience. It looks like you're working on one and we would appreciate anything that improves the developer experience.

@westonruter
Copy link
Member Author

Ok great. I mainly wanted to know if there was a reason for the spec_url not being supplied for each tag spec. I'll work on a PR.

@Gregable
Copy link
Member

This bug is stated as more of a question than a specific feature request. I'm not sure when we would consider it closed as a feature request. Since the question is answered, closing this.

@amedina
Copy link
Member

amedina commented Dec 8, 2020

This is more a bug report than a FR. Could we reopen and seek a solution? /cc @sebastianbenz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants