Skip to content

feat(schema-validity): add page-level JSON-LD validity analyzer (1.7.0)#26

Merged
arberx merged 2 commits intomainfrom
arberx/schema-validity
Apr 30, 2026
Merged

feat(schema-validity): add page-level JSON-LD validity analyzer (1.7.0)#26
arberx merged 2 commits intomainfrom
arberx/schema-validity

Conversation

@arberx
Copy link
Copy Markdown
Member

@arberx arberx commented Apr 30, 2026

Summary

  • New schema-validity analyzer (weight 5) catches issues silently dropped by parseJsonLdScripts: duplicate singleton @types on a page (e.g. two FAQPage blocks — Google flags as "Duplicate field" and invalidates rich results), JSON syntax errors, and empty <script type="application/ld+json"> blocks.
  • Adds extractJsonLdBlocks() helper for richer per-block introspection (index, parse error, top-level @types; handles @graph and @type-array). Existing parseJsonLdScripts is untouched.
  • When a structural error exists (parse error or duplicate singleton), the factor's score is capped at 69 so the issue surfaces in text-mode top recommendations regardless of overall passing grade — schema errors are visible irrespective of numeric score.
  • Wired into ANALYZER_BY_ID + FACTOR_DEFINITIONS, doc-synced across printHelp() / README / skills/aeo/SKILL.md per the CLAUDE.md rule, version bumped 1.6.0 → 1.7.0.

Test plan

  • pnpm typecheck clean
  • pnpm test — 146/146 pass (14 new in test/analyzers/schema-validity.test.ts)
  • pnpm lint clean
  • pnpm run build clean
  • Programmatic smoke test via dist/: duplicate FAQPage → score 69 with cited block indices; malformed JSON → 69 with parser line/column; clean → 100; no JSON-LD → 100 with info finding

🤖 Generated with Claude Code

arberx and others added 2 commits April 30, 2026 13:01
New `schema-validity` analyzer (weight 5) flags problems missed by existing
factors:
- Duplicate singleton @types per page (e.g., two FAQPage blocks — Google
  flags as "Duplicate field" and invalidates rich results)
- JSON syntax errors in any application/ld+json block (previously silently
  swallowed by parseJsonLdScripts)
- Empty / whitespace-only JSON-LD script blocks

When a structural error exists (parse error or duplicate singleton), the
factor's score is capped at 69 so the issue surfaces in text-mode top
recommendations regardless of how many other factors are also failing —
schema errors must be visible irrespective of the numeric score.

Adds `extractJsonLdBlocks()` helper for richer per-block introspection
(index, parse error, top-level @types, handles @graph and @type arrays).
Existing parseJsonLdScripts is untouched (still used by other analyzers).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
The new schema-validity factor scores 100 on the strong fixture (clean,
non-duplicate JSON-LD), shifting the weighted overall from 75 to 76 and
promoting it into the top-2 strengths in the summary string.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@arberx arberx merged commit 2ad9d1a into main Apr 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant