Skip to content

validate_records.py builds its validator without a format checker #125

Description

@chaksaray

Correction, added while PR #130 is in review: this issue's original "Scope" section stated rfc3986-validator was already sufficient and "no new dependency required." That was wrong. It reasoned from #121's finding that date format checking works natively in jsonschema with no extra package, and assumed that transferred here. It doesn't: this issue is about date-time (used by the record schema's published field), a different format string than date (used by the crosswalk schema's generated field), with its own separate registration requirement. rfc3986-validator covers uri, not date-time. mmaxjr caught this in #130 by actually running the check rather than assuming the earlier finding applied, and added rfc3339-validator as the real missing dependency. #130 is still open, pending review — not merged yet. Leaving the original wrong text below intact rather than rewriting it, so the correction is visible, not silent.

Summary

validate_records.py builds its jsonschema validator without a
format checker enabled. date-time and uri formats on published,
last_updated, and researcher_url are currently annotations the
validator reads but does not act on, not enforced constraints. A
malformed value in any of these three fields passes validation silently.

Where this came from

Found by astrogilda while building the crosswalk schema and validator
in #121. That PR's own validate_crosswalks.py runs
Draft202012Validator with FORMAT_CHECKER enabled deliberately, and
the PR's own header comment originally overclaimed that both date and
uri were enforced there, when only date actually was without an
extra dependency. That got corrected in #121 itself (see the
rfc3986-validator addition to pyproject.toml), which is what
surfaces this issue: validate_records.py never had that dependency or
that validator flag to begin with.

Scope

  • Add format_checker=jsonschema.Draft202012Validator.FORMAT_CHECKER
    to wherever validate_records.py constructs its validator, the same
    change already made in validate_crosswalks.py.
  • rfc3986-validator is already a dev dependency as of Add the crosswalk schema every crosswalk already declares #121 (needed
    for uri format checking), no new dependency required here.
    Wrong,
    see correction above
    : date-time needed its own separate package,
    rfc3339-validator, added in Validate AVE record string formats #130.
  • Already confirmed safe: astrogilda checked ahead before proposing
    this and confirmed all 70 records in the corpus currently pass
    ave-record-1.1.0.schema.json with format checking fully enabled.
    Nothing in the existing corpus goes red from this change.

Out of scope

  • Any change to the schema itself. This is purely about the validator
    script actually enforcing what the schema already declares.

Credit

astrogilda offered to take this issue directly during the #121 review
thread. Found and fixed by mmaxjr in #130 (open, pending review), a
first-time contributor, who also caught and corrected the dependency
assumption above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions