From d844aa7e4d760dbe154455fb05a1bbb3f36b5fe2 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Mon, 12 Oct 2020 14:58:13 +0200 Subject: [PATCH] TMSS-190: fix for jsoneditor and meta schemas --- SAS/TMSS/src/tmss/tmssapp/serializers/widgets.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SAS/TMSS/src/tmss/tmssapp/serializers/widgets.py b/SAS/TMSS/src/tmss/tmssapp/serializers/widgets.py index f19ee6f1913..cf663040c05 100644 --- a/SAS/TMSS/src/tmss/tmssapp/serializers/widgets.py +++ b/SAS/TMSS/src/tmss/tmssapp/serializers/widgets.py @@ -58,6 +58,12 @@ class JSONEditorField(serializers.JSONField): # so, let's do the resolving here and feed the resolved schema to the josdejong_jsoneditor_widget schema = json_utils.resolved_refs(schema) + # the editor already fetched and cached common meta schema's from json-schema.org + # and raises an error if we supply it as well + # so, set schema to None for those + if 'json-schema.org' in value.get('$schema'): + schema = None + self.style = {'template': 'josdejong_jsoneditor_widget.html', 'schema': json.dumps(schema)} -- GitLab