From 8f94de271be168389b713729cbe05b7c641a304a Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Thu, 12 Dec 2019 13:45:58 +0000 Subject: [PATCH] Fixing anno support --- schema/iiif_3_0.json | 32 ++------------------------------ schema/schemavalidator.py | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 42 deletions(-) diff --git a/schema/iiif_3_0.json b/schema/iiif_3_0.json index 0958e30..73e4354 100644 --- a/schema/iiif_3_0.json +++ b/schema/iiif_3_0.json @@ -759,44 +759,16 @@ "format": "uri", "pattern": "^http.*$" }, - { - "$ref": "#/classes/pointSelector" - }, { "type": "object", "properties": { - "oneOf": [ - { - "type": { - "type": "string", - "pattern": "^FragmentSelector$" - } - }, - { - "type": { - "type": "string", - "pattern": "^SvgSelector$" - } - } - ] + "type": { "type": "string" }, + "t": { "$ref": "#/types/duration" } }, "required": ["type"] } ] }, - "pointSelector": { - "type": "object", - "properties": { - "type": { - "type": "string", - "pattern": "^PointSelector$" - }, - "x": { "type": "integer" }, - "y": { "type": "integer" }, - "t": { "$ref": "#/types/duration" } - }, - "required": ["type"] - }, "range": { "allOf": [ { "$ref": "#/types/class" }, diff --git a/schema/schemavalidator.py b/schema/schemavalidator.py index cdc03e4..0e7aedd 100755 --- a/schema/schemavalidator.py +++ b/schema/schemavalidator.py @@ -45,18 +45,17 @@ def validate(data, version, url): errors = errors[0].context for err in errors: if 'is not valid under any of the given schemas' in err.message: - continue - #subErrorMessages = [] - #for subErr in err.context: - # if 'is not valid under any of the given schemas' not in subErr.message: - # subErrorMessages.append(subErr.message) - #errorsJson.append({ - # 'title': 'Error {} of {}.\n Message: Failed to process submission due too many errors'.format(errorCount, len(errors)), - # 'detail': 'This error is likely due to other listed errors. Fix those errors first.', - # 'description': "{}".format(subErrorMessages), - # 'path': '', - # 'context': '' - #}) + subErrorMessages = [] + for subErr in err.context: + if 'is not valid under any of the given schemas' not in subErr.message: + subErrorMessages.append(subErr.message) + errorsJson.append({ + 'title': 'Error {} of {}.\n Message: Failed to process submission due too many errors'.format(errorCount, len(errors)), + 'detail': 'This error is likely due to other listed errors. Fix those errors first.', + 'description': "{}".format(subErrorMessages), + 'path': '', + 'context': '' + }) else: detail = ''