From d3c5ef9f2c0ca057440ad266b57265dacf57a0a6 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Mon, 30 May 2022 14:16:19 +0200 Subject: [PATCH] skipping strict check in document for now. --- LCS/PyCommon/json_utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/LCS/PyCommon/json_utils.py b/LCS/PyCommon/json_utils.py index f5ca530baf5..c9d4d252ce1 100644 --- a/LCS/PyCommon/json_utils.py +++ b/LCS/PyCommon/json_utils.py @@ -435,11 +435,12 @@ def validate_json_against_schema(json_doc: typing.Union[str,dict], schema: typin except json.decoder.JSONDecodeError as e: raise jsonschema.exceptions.ValidationError("Invalid JSON: %s\n%s" % (str(e), schema)) - if '$schema' not in json_doc: - raise jsonschema.exceptions.ValidationError("The json document does not contain a $schema property\n%s" % (schema,)) - - if json_doc['$schema'].rstrip('/ref_resolved').rstrip('#').rstrip('/') != schema.get('$id','').rstrip('/ref_resolved').rstrip('#').rstrip('/'): - raise jsonschema.exceptions.ValidationError("The json document with $schema='%s' cannot be validated by schema with $id='%s'" % (json_doc['$schema'], schema.get('$id'))) + # TODO: uncomment, and make sure all production templates are ok. + # if '$schema' not in json_doc: + # raise jsonschema.exceptions.ValidationError("The json document does not contain a $schema property\n%s" % (schema,)) + # + # if json_doc['$schema'].rstrip('/ref_resolved').rstrip('#').rstrip('/') != schema.get('$id','').rstrip('/ref_resolved').rstrip('#').rstrip('/'): + # raise jsonschema.exceptions.ValidationError("The json document with $schema='%s' cannot be validated by schema with $id='%s'" % (json_doc['$schema'], schema.get('$id'))) # resolve $refs to fill in defaults for those, too schema = resolved_remote_refs(schema, cache=cache, max_cache_age=max_cache_age) -- GitLab