Skip to content

Commit

Permalink
Merge d3d6b04 into 063d493
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Oct 7, 2022
2 parents 063d493 + d3d6b04 commit 4ab3c19
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 47 deletions.
32 changes: 32 additions & 0 deletions fixtures/3/collection_of_canvases.json
@@ -0,0 +1,32 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://example.org/iiif/collection/invalid",
"type": "Collection",
"label": { "en": [ "Invalid collection of canvases and ranges" ] },
"items": [
{
"id": "https://example.org/iiif/canvas/1",
"type": "Canvas",
"label": { "en": [ "Canvas 1" ] },
"thumbnail": [
{
"id": "https://example.org/manifest1/thumbnail.jpg",
"type": "Image",
"format": "image/jpeg"
}
]
},
{
"id": "https://example.org/iiif/2/range/1",
"type": "Range",
"label": { "en": [ "Range example" ] },
"thumbnail": [
{
"id": "https://example.org/manifest2/thumbnail.jpg",
"type": "Image",
"format": "image/jpeg"
}
]
}
]
}
108 changes: 108 additions & 0 deletions fixtures/3/range_range.json
@@ -0,0 +1,108 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://example.org/iiif/book1/manifest",
"type": "Manifest",
"label": { "en": [ "Range containng ranges" ] },
"items": [
{
"id": "https://example.org/iiif/book1/canvas/p1",
"type": "Canvas",
"label": { "none": [ "p. 1" ] },
"height": 1000,
"width": 750,
"items": [
{
"id": "https://example.org/iiif/book1/page/p1/1",
"type": "AnnotationPage",
"items": [
{
"id": "https://example.org/iiif/book1/annotation/p0001-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://example.org/iiif/book1/page1/full/max/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"service": [
{
"id": "https://example.org/iiif/book1/page1",
"type": "ImageService3",
"profile": "level2"
}
],
"height": 2000,
"width": 1500
},
"target": "https://example.org/iiif/book1/canvas/p1"
}
]
}
]
},
{
"id": "https://example.org/iiif/book1/canvas/p2",
"type": "Canvas",
"label": { "none": [ "p. 2" ] },
"height": 1000,
"width": 750,
"items": [
{
"id": "https://example.org/iiif/book1/page/p2/1",
"type": "AnnotationPage",
"items": [
{
"id": "https://example.org/iiif/book1/annotation/p0002-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://example.org/iiif/book1/page2/full/max/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"service": [
{
"id": "https://example.org/iiif/book1/page2",
"type": "ImageService3",
"profile": "level2"
}
],
"height": 2000,
"width": 1500
},
"target": "https://example.org/iiif/book1/canvas/p2"
}
]
}
]
}
],

"structures": [
{
"id": "https://example.org/iiif/book1/range/r0",
"type": "Range",
"label": { "en": [ "Table of Contents" ] },
"items": [
{
"id": "https://example.org/iiif/book1/range/r1",
"type": "Range",
"label": { "en": [ "toc2" ] },
"items": [
{
"id": "https://example.org/iiif/book1/canvas/p1",
"type": "Canvas"
},
{
"id": "https://example.org/iiif/book1/range/r1",
"type": "Range",
"label": { "en": [ "toc2" ] },
"items":[{
"id": "https://example.org/iiif/book1/canvas/p2",
"type": "Canvas"
}]
}
]
}
]
}
]
}
4 changes: 2 additions & 2 deletions iiif-presentation-validator.py
Expand Up @@ -111,13 +111,13 @@ def check_manifest(self, data, version, url=None, warnings=[]):
# Passed!
okay = 1
except KeyError as e:
print ('Failed falidation due to:')
print ('Failed validation due to:')
traceback.print_exc()
err = 'Failed due to KeyError {}, check trace for details'.format(e)
okay = 0
except Exception as e:
# Failed
print ('Failed falidation due to:')
print ('Failed validation due to:')
traceback.print_exc()
err = e
okay = 0
Expand Down
4 changes: 3 additions & 1 deletion schema/error_processor.py
Expand Up @@ -116,6 +116,7 @@ def diagnoseWhichOneOf(self, error_path, IIIFJsonPath):
# its not another oneOf error
if addErrors:
# if error is also a oneOf then diagnoise again
#print ('Schema path: {} error path: {}'.format(err.absolute_schema_path, error_path))
if err.absolute_schema_path[-1] == 'oneOf' and err.absolute_schema_path != error_path and 'rights' not in err.absolute_schema_path:
error_path.append(oneOfIndex) # this is is related to one of the original oneOfs at index oneOfIndex
error_path.extend(err.absolute_schema_path) # but we found another oneOf test at this location
Expand Down Expand Up @@ -323,9 +324,10 @@ def isTypeMatch(self, iiifPath, iiif_asset, schemaType, IIIFJsonPath):
indexDelta += len(str(indexes[count])) -1
count += 1

#print ('JsonPath: {} IIIF Path {} '.format(iiifPath, IIIFJsonPath))
#print ('JsonPath: {} IIIF Path {} type: {}'.format(iiifPath, IIIFJsonPath, schemaType))
path = parse(iiifPath)
results = path.find(iiif_asset)
#print ('Path: {} Results: '.format(path, results))
if not results:
# type not found so return True as this maybe the correct error
return True
Expand Down

0 comments on commit 4ab3c19

Please sign in to comment.