You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
schema/json-ld-valid: validator still stricter than schema.org/Google (arrays, AggregateOffer, publisher) #469
Found while fixing #463. packages/parser/src/schema/validator.ts, the validator behind schema/json-ld-valid, is stricter than schema.org or Google in a few more places. Each one yields a false positive on valid markup:
Single values where it wants arrays. In JSON-LD any property may hold one value or an array. Recipe.recipeIngredient and Recipe.recipeInstructions are typed array, so a single string (which Google accepts for recipeInstructions) reports must be an array. FAQPage.mainEntity and BreadcrumbList.itemListElement behave the same way for a single object.
AggregateOffer.Product.offers requires price, priceCurrency and availability on every offer. An AggregateOffer carries lowPrice / highPrice instead of price, so it reports Product.offers.price is required.
Article.publisher (and publisher.logo) are required. Google's Article documentation lists no required properties, and publisher is not among the recommended ones. A Person publisher has no logo at all.
Untyped top-level @graph nodes are not indexed for @id resolution.extractSchemas keeps only nodes with an @type, so a reference to {"@id":"#p","name":"..."} with no @type is checked as written.
Separately, the item checks on BreadcrumbList list items and the name/acceptedAnswer checks on FAQPage questions never run: validatePropertyType returns before the array/item branch because rule.required is unset at that level. Fixing that adds findings, so it needs the "last breadcrumb needs no item" exemption Google documents.
Acceptance Criteria
recipeIngredient / recipeInstructions given as a single string, and mainEntity given as a single Question, are not reported as invalid
A Product whose offers is an AggregateOffer with lowPrice and priceCurrency reports no offers.price issue
An Article without publisher, or with a Person publisher that has no logo, reports no publisher / publisher.logo issue (or the rule's docs justify keeping it)
A bare {"@id"} reference to an untyped top-level node on the same page resolves
BreadcrumbList item checks either run (with the last item exempt from item) or the dead branch is removed
docs/rules/schema/json-ld-valid.mdx matches the new behaviour
Activity
fix(rules): align json-ld-valid with schema.org and Google #469
fix(rules): align json-ld-valid with schema.org and Google #469 (#500)