Commit 18f6cfa4 authored by Titouan Soulard's avatar Titouan Soulard

erp5_json_form: order JSON Schema keys and do not enforce $id

parent 3f4ad9df
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
############################################################################## ##############################################################################
import json import json
import jsonschema import jsonschema
from collections import OrderedDict
from erp5.component.document.JSONType import JSONType from erp5.component.document.JSONType import JSONType
from erp5.component.document.TextDocument import TextDocument from erp5.component.document.TextDocument import TextDocument
...@@ -89,8 +92,10 @@ class JSONForm(JSONType, TextDocument): ...@@ -89,8 +92,10 @@ class JSONForm(JSONType, TextDocument):
return True return True
def returnSchema(self, schema, path, REQUEST): def returnSchema(self, schema, path, REQUEST):
schema = json.loads(schema) schema = json.loads(schema, object_pairs_hook=OrderedDict)
schema["$id"] = self.absolute_url().strip() + path # Replace user URL by absolute URL
if "$id" in schema:
schema["$id"] = self.absolute_url().strip() + path
if REQUEST is not None: if REQUEST is not None:
control = [] control = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment