Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

'target' on 'AnnotationNormalized' is not being normalized into an Array<ContentResource> #14

@jbaiter

Description

@jbaiter

When loading the manifest https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/manifest.json with vault and drilling down into the canvas' annotations via vault.get, the target key is not being normalized into an array as specified by the type annotations on AnnotationNormalized:

const manifest = await vault.loadManifest('https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/manifest.json');
for (const canvas of vault.get<CanvasNormalized>(manifest.items)) {
    const annos = vault.get<AnnotationPageNormalized>(canvas.items)
        .flatMap(p => vault.get<AnnotationNormalized>(p.items));
    for (const anno of annos) {
      console.dir(anno.target, { depth: null });
    }
}

Expected Output (Array<ContentResource>):

[{ id: 'https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/canvas/p1', type: ??? }]
[{ id: ''https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/canvas/p1#xywh=3949,994,1091,1232', type: ??? }]

Actual Output: (ContentResourceString?)

'https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/canvas/p1'
'https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/canvas/p1#xywh=3949,994,1091,1232'

I'm also a bit confused as to why AnnotationNormalized#target has the type Array<Reference<"ContentResource">>, shouldn't it be a union Array<Reference<"ContentResource"> | ContentResourceString>? Although that's probably more of a question for https://github.com/IIIF-Commons/presentation-3-types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions