Skip to content

Commit

Permalink
Merge 8ca48b9 into c91a2c6
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Mar 11, 2020
2 parents c91a2c6 + 8ca48b9 commit 265a45c
Show file tree
Hide file tree
Showing 7 changed files with 601 additions and 44 deletions.
56 changes: 56 additions & 0 deletions fixtures/3/broken_service.json
@@ -0,0 +1,56 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://example.org/iiif/book1/manifest",
"type": "Manifest",
"label": { "en": [ "Book 1" ] },
"thumbnail": [
{
"id": "https://example.org/iiif/book1/page1/full/80,100/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"service":
{
"id": "https://example.org/iiif/book1/page1",
"type": "ImageService3",
"profile": "level1"
}

}
],
"items": [
{
"id": "https://example.org/iiif/book1/canvas/p1",
"type": "Canvas",
"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"
}
]
}
]
}
]
}
13 changes: 12 additions & 1 deletion iiif-presentation-validator.py
Expand Up @@ -8,6 +8,7 @@
import os
from gzip import GzipFile
from io import BytesIO
from jsonschema.exceptions import ValidationError, SchemaError

try:
# python3
Expand Down Expand Up @@ -61,7 +62,17 @@ def check_manifest(self, data, version, url=None, warnings=[]):
infojson = {}
# Check if 3.0 if so run through schema rather than this version...
if version == '3.0':
infojson = schemavalidator.validate(data, version, url)
try:
infojson = schemavalidator.validate(data, version, url)
for error in infojson['errorList']:
error.pop('error', None)
except ValidationError as e:
infojson = {
'received': data,
'okay': 0,
'error': str(e),
'url': url
}
else:
reader = ManifestReader(data, version=version)
err = None
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -2,3 +2,4 @@ bottle
iiif_prezi
jsonschema
mock
jsonpath-rw

0 comments on commit 265a45c

Please sign in to comment.