aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/main.py
diff options
context:
space:
mode:
authorAdam Novak2020-04-17 13:07:18 -0700
committerAdam Novak2020-04-17 13:07:18 -0700
commitb2d3b101b7a44932632036146b7c271acfd67593 (patch)
tree5696b0f043b8d364a61992d276b4f14ed8f0e122 /bh20simplewebuploader/main.py
parent88e6bb6e82f606c91fca6b3edd410cb28146f569 (diff)
downloadbh20-seq-resource-b2d3b101b7a44932632036146b7c271acfd67593.tar.gz
bh20-seq-resource-b2d3b101b7a44932632036146b7c271acfd67593.tar.lz
bh20-seq-resource-b2d3b101b7a44932632036146b7c271acfd67593.zip
Pull 'doc' from the schema through to the frontend
Diffstat (limited to 'bh20simplewebuploader/main.py')
-rw-r--r--bh20simplewebuploader/main.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 0db7d84..8c5c18c 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -68,7 +68,8 @@ def generate_form(schema, options):
form section in the template) or an 'id', 'label', 'type', and 'required'
(in which case we make a form field in the template). Non-heading dicts
with type 'select' will have an 'options' field, with a list of (name,
- value) tuples, and represent a form dropdown element.
+ value) tuples, and represent a form dropdown element. Non-heading dicts may
+ have a human-readable 'docstring' field describing them.
Takes the deserialized metadata schema YAML, and also a deserialized YAML
of option values. The option values are keyed on (unscoped) field name in
@@ -110,8 +111,12 @@ def generate_form(schema, options):
# For each field
ref_iri = None
+ docstring = None
if not isinstance(field_type, str):
# If the type isn't a string
+
+ # It may have documentation
+ docstring = field_type.get('doc', None)
# See if it has a more info/what goes here URL
predicate = field_type.get('jsonldPredicate', {})
@@ -156,6 +161,8 @@ def generate_form(schema, options):
record['required'] = not optional and not subtree_optional
if ref_iri:
record['ref_iri'] = ref_iri
+ if docstring:
+ record['docstring'] = docstring
if field_name in options:
# The field will be a 'select' type no matter what its real