Repository navigation
fix(rules): align json-ld-valid with schema.org and Google #469 - #500
Merged
Merged
Conversation
nc9
marked this pull request as ready for review
October 6, 2026 13:55
The validator behind schema/json-ld-valid flagged valid markup: - a single recipeIngredient/recipeInstructions, FAQPage.mainEntity or BreadcrumbList.itemListElement, where any JSON-LD property may hold one value or a list - an AggregateOffer for lacking price and availability; it now needs lowPrice and priceCurrency - an Article without a publisher, or a Person publisher without a logo - a reference to an untyped top-level @graph node, which the parser dropped; such nodes are now kept beside the schemas and indexed The BreadcrumbList and FAQPage entry checks never ran. They now do, with Google's exemption: the last crumb by position needs no item, and a name on the crumb's item node counts. Signed-off-by: Nik Cubrilovic <[email protected]>
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #469
Cause
packages/parser/src/schema/validator.ts, behindschema/json-ld-valid, read schema.org more strictly than schema.org or Google do:recipeIngredientandrecipeInstructionswere typedarray, so a single string reportedmust be an array.Product.offersrequiredprice/priceCurrency/availabilityon every offer, including anAggregateOffer, which carrieslowPriceinstead.Article.publisherandpublisher.logowere required.extractSchemaskept only typed nodes, so a reference to an untyped top-level@graphnode was checked as written.itemrules onBreadcrumbList.itemListElementandFAQPage.mainEntitynever ran:validatePropertyTypereturned before itsarray/itembranch becauserule.requiredwas unset at that level. A single object was also rejected there withmust be an array.Fix
recipeIngredienttakes a string or list of strings.recipeInstructionstakes text, an object (HowToStep,HowToSection), or a list of either.FAQPage.mainEntityandBreadcrumbList.itemListElementtake one entry or a list, and their entry checks now run:nameandacceptedAnswer.position,nameanditem, except the last crumb, which may omititem(Google's exemption). The last crumb is the highestposition, falling back to written order when no crumb has one.{"@id"}takes its fields, includingposition, from the node it names. Anameon the crumb'sitemnode counts, inline or by reference.requiredByTypegivesAggregateOfferits own list,lowPriceandpriceCurrency, which Google requires for it.Article.publisheris no longer required, and a given publisher needs onlyname.@idand no@typebeside the schemas (SchemaCollection.untypedNodes, stored and rehydrated).validateSchemas(schemas, untypedNodes)indexes them for reference resolution. They are not validated as schemas. Bare{"@id"}nodes are not kept.docs/rules/schema/json-ld-valid.mdxdescribes each of these.Running the breadcrumb and FAQ checks adds findings that never showed before: a crumb before the last with no
item, a question with no answer. That is the "fixing it adds findings" side the issue calls out. The real run below shows one.Proof
Real run, CLI from source against a local fixture (
python3 -m http.server): five pages,audit --http --offline --refresh -m 6 --rule-include schema/json-ld-valid -f json.@graphnodeitemTests
packages/rules/tests/json-ld-valid.test.ts: 55 tests, 20 of them new. 17 fail against the origin/main validator. They cover each acceptance criterion plus the kept true positives:price; AggregateOffer withoutlowPricenameitem; unnamed crumbpositionand a@typeofconstructordo not throwThree existing assertions on
publisher.logowere updated.Also run and passing: schema-graph-flattening, schema-entity-rules, schema-coverage-outlier, core-canonical-form-drift (184); streaming-rules-canonical, site-query-schema-coverage, entity-rules goldens (28); rule-cache codec / replay / page-rule-site-context (31); template-verdict-page-independence (78); CLI graph schema extractor and prototype-pollution (27).
tsgo --noEmitclean inpackages/parserandpackages/rules.[email protected] check --strictpasses.Notes
--refresh. Everything else is re-validated at audit time as before. This is documented on the rule page.headline/image/datePublished/author, Recipe its ingredients and instructions, and an Offer itsavailability. Google lists these as recommended. Also left: anAggregateOfferwhose type appears only on a bare typed reference elsewhere in the graph is treated as an Offer.Changelog suggestion
schema/json-ld-validno longer flags valid markup: a single recipe ingredient or instruction, a single FAQ question or breadcrumb, anAggregateOffer, an Article without a publisher logo, or a reference to an untyped@graphnode. It now checks every breadcrumb and FAQ question, with the last breadcrumb exempt fromitem.