Writing the schema
Field types reference
text — short free-text field
{
"id": "my_text",
"label": "Title",
"type": "text",
"required": true,
"output": { "path": "title", "mode": "set" }
}
textarea — long structured text
{
"id": "abstract",
"label": "Abstract",
"type": "textarea",
"rows": 6,
"output": {
"path": "descriptions",
"mode": "append",
"tpl": { "description": "$value", "descriptionType": "Abstract" }
}
}
number — numeric with bounds
{
"id": "publication_year",
"label": "Publication Year",
"type": "number",
"min": 2000,
"max": 2030,
"output": { "path": "publicationYear", "mode": "set_int" }
}
select — single choice from fixed options
{
"id": "resource_type",
"label": "Resource Type",
"type": "select",
"options": [
{ "value": "Dataset", "label": "Dataset" },
{ "value": "Image", "label": "Image" }
],
"output": {
"path": "types",
"mode": "append",
"tpl": { "resourceType": "$value" }
}
}
Without a default, the browser still shows the first <option> as selected — the field only has no real value once the user explicitly picks a different one or an empty option. For an optional field (required: false, no default) where that would be misleading, add { "value": "", "label": "— Not specified —" } as the first option: mode: "append_if" already skips the empty string, so nothing gets submitted until the user actually chooses. See sections.disease.disease_source.
checkbox_group — boolean toggles that open sections
{
"id": "intervention_types",
"label": "Select interventions",
"type": "checkbox_group",
"options": [
{
"value": "GENE",
"label": "Genetic Modification",
"opens_section": "genes"
}
]
}
multi_select — multiple selection from a vocabulary
{
"id": "contributor_roles",
"label": "CRediT Roles",
"type": "multi_select",
"vocabulary": "credit_roles",
"output": {
"path": "contributors",
"mode": "append_from_array"
}
}
api_search — remote search with manual fallback
{
"id": "gene_search",
"label": "Gene Symbol",
"type": "api_search",
"api": "mygene",
"allow_manual": true,
"show_xrefs": true,
"xref_concept": "Gene",
"placeholder": "E.g. Apoe...",
"output": {
"path": "subjects",
"mode": "append",
"tpl": {
"subject": "$label",
"subjectScheme": "$scheme",
"valueURI": "$id"
}
}
}
show_xrefs— displays the selected result's cross-reference links (its mapper'sxrefs/xref_from_extra, see Mapper extras & cross-references) under the fieldxref_concept— labels which concept those cross-references belong to (e.g."Gene","Allele"), so the app can group/tell apart the xrefs of two differentapi_searchfields shown in the same repeatable row (e.g.gene_search's MGI/RGD/ZFIN links vs.allele_search's own MGI allele / Alliance links)- Don't hardcode a label prefix into
subject(e.g."Gene: $label") — write the raw value and letdisplay_mapping.labels[subjectScheme]supply the prefix shown on the dataset page, see Display mapping
preset_or_search — quick presets + API fallback
{
"id": "organism_choice",
"label": "Model Organism",
"type": "preset_or_search",
"vocabulary": "organism_presets",
"search_api": "ols_ncbitaxon",
"output": {
"path": "subjects",
"mode": "append",
"tpl": {
"subject": "$label",
"subjectScheme": "NCBITaxon",
"valueURI": "$id"
}
}
}
Auto-filled but editable field (bind_to)
A plain field can be wired to copy a value out of a related api_search field's selected result, while staying editable — use this when auto-fill from the API isn't always reliable. sections.genes.mutationType_display is a real example: it's filled from whichever allele the user picked, but the user can type over it when the API had nothing useful:
{
"id": "allele_search",
"type": "api_search",
"api": "ensembl_allele",
"update_display_field": "mutationType_display"
},
{
"id": "mutationType_display",
"label": "Mutation Type",
"type": "text",
"allow_manual": true,
"dependent_on_field": "allele_search",
"bind_to": "consequenceType || geneMutationType",
"help": "Auto-filled from the allele search when the API provides it. If it stays empty or looks wrong, enter it manually."
}
update_display_field(on theapi_searchfield) — names the field that should receive data from the selected resultbind_to(on the display field) — the key read from the selected result'smapper.extra(see Mapper extras & cross-references); accepts a"a || b"fallback chain, tried in order, same as an outputtpldependent_on_field— the field that triggers the auto-fill, and whose changes should reset this one- Leave off
readonly(or set itfalse) so the field stays editable, and write ahelptext that tells the user when to fill it in themselves
