Skip to content

schema/json-ld-valid: accesses parsed.schemas.valid instead of parsed.schema.valid (always fails) #3

Closed

Description

@Fede654

Bug Description

The schema/json-ld-valid rule always reports a failure because it accesses parsed.schemas.valid but the valid field only exists on parsed.schema (singular, not plural).

Since parsed.schemas.valid is undefined, the check !undefined evaluates to true, triggering a false failure on every page.

Environment

  • squirrelscan version: v0.0.25
  • OS: Linux (Debian 12)

Steps to Reproduce

  1. Add a valid JSON-LD schema to any page:
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "Example Business"
}
</script>
  1. Run squirrel audit <url> --format llm
  2. schema/json-ld-valid reports failure despite valid JSON-LD

Root Cause

From analysis of the rule execution:

  • The parser stores validation results on parsed.schema.valid (singular)
  • The json-ld-valid rule accesses parsed.schemas.valid (plural)
  • parsed.schemas exists but does not have a valid property
  • !parsed.schemas.valid → !undefined → true → always triggers failure

Expected Behavior

The rule should access parsed.schema.valid (singular) to correctly check JSON-LD validity.

Actual Behavior

Rule always returns failure because it reads from the wrong field name.

Database Evidence

Querying the project database confirms:

  • parsed.schema has valid: true and errors: []
  • parsed.schemas has no valid field
SELECT json_extract(parsed_data, '$.schema.valid') as schema_valid,
       json_extract(parsed_data, '$.schemas.valid') as schemas_valid
FROM pages WHERE url LIKE '%example%';
-- Returns: schema_valid=1, schemas_valid=NULL

Activity

  1. self-assigned this
    on Feb 2, 2026
  2. added theissue type on Feb 2, 2026
  3. nc9 commented on Feb 2, 2026

    @nc9
    Contributor

    fix inbound for this! thanks for reporting it

  4. Fede654 commented on Feb 2, 2026

    @Fede654
    Author

    Glad to help!

  5. nc9 commented on Feb 2, 2026

    @nc9
    Contributor

    Fixed in v0.0.26 via commit 308c7c9.

    The schema handling was rewritten with a SchemaCollection class that has proper typed accessors including a valid getter. The rule now correctly accesses schemas.valid where schemas is a class instance with the getter, not a plain object.

  6. nc9 commented on Feb 2, 2026

    @nc9
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions