Jump to content

JsonSchema:SchemaBuilder/EnumTemplate

From Wikiyouth
$schema"http://json-schema.org/draft-07/schema#"
$id"https://wikisphere.org/wiki/JsonSchema:SchemaBuilder/EnumTemplate"
title"Enum options"
description"Where dropdown options come from: one watched field, or a mix of watched fields and static entries."
type"object"
definitions
DynamicEntry
title"Dynamic entry"
description"Options come from another field in this form (its value is watched and re-evaluated on change)."
type"object"
properties
source
title"Watched field"
description"Name of the field whose value supplies the options."
type"string"
examples
"countries"
"users"
"categories"
title
title"Title template"
description"Display label for each option. Use {{item.property}} to reference fields of the current item."
type"string"
examples
"{{item.name}}"
"{{item.name}} ({{item.email}})"
value
title"Value template"
description"Underlying value for each option. Use {{item.property}} to reference fields of the current item."
type"string"
examples
"{{item.id}}"
"user:{{item.id}}"
filter
title"Filter expression"
description"Only keep items where this template evaluates to a truthy value."
type"string"
examples
"{{item.active}}"
"{{item.status === 'published'}}"
slice
title"Slice"
description"Take a sub-range of items, like Array.prototype.slice. One value = from index to end; two values = start and end."
type"array"
items
type"integer"
minItems1
maxItems2
examples
0
10
2
sort
title"Sort"
description"Sort options by value. Titles follow their values."
type"string"
enum
"asc"
"desc"
default"asc"
options
enum_titles
"Ascending"
"Descending"
required
"source"
additionalPropertiesfalse
StaticEntry
title"Static entry"
description"A fixed list of options. Use to mix in sentinel entries like "none" or "inherit" alongside dynamic ones."
type"object"
properties
items
title"Entries"
description"Fixed list of options."
type"array"
minItems1
items
title"Option"
type"object"
properties
value
title"Value"
description"The underlying value submitted for this option."
type"string"
examples
"none"
"inherit"
"draft"
title
title"Title"
description"Optional display label. Defaults to the value if omitted."
type"string"
examples
"— None —"
"Inherit from parent"
required
"value"
additionalPropertiesfalse
examples
value"none"
title"— None —"
value"inherit"
title"— Inherit —"
value"draft"
value"published"
value"archived"
title"Archived (read-only)"
required
"items"
additionalPropertiesfalse
oneOf
title"Single source"
description"Options come from one watched field."
$ref"#/definitions/DynamicEntry"
examples
source"countries"
source"users"
value"{{item.id}}"
title"{{item.name}}"
filter"{{item.active}}"
sort"asc"
title"Multiple sources"
description"Combine watched fields and static entries into one dropdown. Each entry contributes its own options, in order."
type"array"
items
oneOf
$ref"#/definitions/DynamicEntry"
$ref"#/definitions/StaticEntry"
minItems1
examples
source"items"
value"{{item.id}}"
title"{{item.name}}"
items
value"none"
title"— None —"
value"inherit"
title"— Inherit —"
source"groups"
value"group:{{item.id}}"
title"Group: {{item.name}}"
source"users"
value"user:{{item.id}}"
title"User: {{item.name}}"