feat(iiif-validator): add IIIF Presentation Manifest validator#426
Merged
Conversation
New dependency-light package exposing validateManifest(url, { fetch, timeoutMs }).
Dereferences a URL with Accept: application/ld+json and an AbortSignal timeout.
Lightweight version-aware check: accepts v2 (sc:Manifest) and v3 (Manifest),
@context as string, array or object. Never throws; returns a coarse verdict. fetch is injectable.
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.
What
Adds
@lde/iiif-validator, a small, dependency-light package that validates whether a URL dereferences to a valid IIIF Presentation Manifest.Why
A reusable building block for Linked Data tooling that needs to tell a declared IIIF manifest apart from one that actually resolves and parses. The first consumer is the Dataset Knowledge Graph, which moves IIIF conformance from declared to validated by dereferencing a sample of manifest URIs per dataset. IIIF is an international standard with no NDE specifics, so the verifier belongs here, as a sibling to
distribution-probe/distribution-downloader.Behaviour
Accept: application/ld+json, application/json, following redirects, using the globalfetchwith anAbortSignaltimeout (default 10 000 ms). Both are injectable (fetch,timeoutMs).@contextreferences an IIIF Presentation context, andtype/@typeindicates a manifest — accepting v3 (Manifest) and v2 (sc:Manifest).@contextmay be a string, array, or object. The version segment is accepted version-agnostically.@context, or wrongtypeall yieldvalid: falsewith a coarsereason. No deep JSON Schema validation, no dependency on the hosted IIIF Presentation Validator service.ManifestValidationverdict.Tests
Unit-tested through the public interface with an injected fake
fetch(no network): v3 / v2 manifests,@contextas string / array / object, and each failure reason (http-error,timeout,network-error,invalid-json,not-a-manifest).