diff --git a/LCS/PyCommon/json_utils.py b/LCS/PyCommon/json_utils.py index f5ca530baf50e73e25cbbba69c21f85b006899bd..c9d4d252ce1f6f3c5c9a876a28d2eed9e313f6d1 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)