Skip to content
Snippets Groups Projects
Verified Commit 90570a20 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

DOC: jsex: Better docstring, a few new TODOs

parent e6a13890
No related branches found
No related tags found
2 merge requests!89ENH: JsonSchemaExporter accepts do_not_create parameter.,!88jsex / yaml parser
Pipeline #44126 failed
...@@ -74,7 +74,7 @@ class JsonSchemaExporter: ...@@ -74,7 +74,7 @@ class JsonSchemaExporter:
additional `unit` key is added to the schema itself which is purely additional `unit` key is added to the schema itself which is purely
annotational and ignored, e.g., in validation. Default is True. annotational and ignored, e.g., in validation. Default is True.
do_not_create : list[str] do_not_create : list[str]
A list of RedcordType names, for which there should be no option A list of reference Property names, for which there should be no option
to create them. Instead, only the choice of existing elements should to create them. Instead, only the choice of existing elements should
be given. be given.
do_not_retrieve : list[str] do_not_retrieve : list[str]
...@@ -194,9 +194,12 @@ class JsonSchemaExporter: ...@@ -194,9 +194,12 @@ class JsonSchemaExporter:
name=prop.name, datatype=get_list_datatype(prop.datatype, strict=True)) name=prop.name, datatype=get_list_datatype(prop.datatype, strict=True))
json_prop["items"], inner_ui_schema = self._make_segment_from_prop(list_element_prop) json_prop["items"], inner_ui_schema = self._make_segment_from_prop(list_element_prop)
if prop.name in self._multiple_choice and prop.name in self._do_not_create: if prop.name in self._multiple_choice and prop.name in self._do_not_create:
# TODO: if not multiple_choice, but do_not_create:
# "ui:widget" = "radio" & "ui:inline" = true
# TODO: set threshold for number of items.
json_prop["uniqueItems"] = True json_prop["uniqueItems"] = True
ui_schema["ui:widget"] = "checkboxes" ui_schema["ui:widget"] = "checkboxes"
ui_schema["ui:options"] = {"inline": True} ui_schema["ui:inline"] = True
if inner_ui_schema: if inner_ui_schema:
ui_schema["items"] = inner_ui_schema ui_schema["items"] = inner_ui_schema
elif prop.is_reference(): elif prop.is_reference():
...@@ -512,7 +515,7 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T ...@@ -512,7 +515,7 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T
additional `unit` key is added to the schema itself which is purely additional `unit` key is added to the schema itself which is purely
annotational and ignored, e.g., in validation. Default is True. annotational and ignored, e.g., in validation. Default is True.
do_not_create : list[str], optional do_not_create : list[str], optional
A list of RedcordType names, for which there should be no option A list of reference Property names, for which there should be no option
to create them. Instead, only the choice of existing elements should to create them. Instead, only the choice of existing elements should
be given. be given.
do_not_retrieve : list[str], optional do_not_retrieve : list[str], optional
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment