Below is an updated workinging model for HAL-FORMS options
control. See notes below for details. Comments welcome.
{
"_templates" : {
"default" : {
...
"properties" : [
{
"name" : "...",
"value" : "...",
"prompt" : "...",
"options" : {
"inline" : ["...", "..." , ...] | [{"prompt" : "...", "value" : "..."}, {...}, ...],
"link" : {
"href" : "...",
"templated" : "false",
"accept" : "application/json|text/csv..."
},
"promptField" : "prompt",
"valueField" : "value",
"minSelect" : "0",
"maxSelect" : "1",
"autocomplete" : "false"
}
}
]
}
}
}
-
No longer tying the
options
control to thetype
property. This meansoptions
MAY appear on anyproperty
element (e.g.type=email
,type=datetime
, etc.). Should there be any restrictions on this (e.g.options
SHOULD/MUST not appear (SHOULD/MUST be ingnored) whentype=range
, etc.? -
Cardinality is handled by the new
options.minSelect
andoptions.maxSelect
. They default to 0 and 1 respectively. IOW, you can pick no more than one and could leave it unselected. You can supply one of these or both, or none. If none, the defaults apply. Note this can cause a conflict ifrequired=true
. We'll need to offer guidance (e.g.required
overridesoptions.minSelect
whenoptions.minSelect=0
, etc.) -
Default format for
options.link.accept
isapplication/json
. Iflink.href
is set andlink.accept
is missing, assume it is set toapplication/json
. Also, iflink.accept
value sent to the server is invalid, unparseable, or not supported, the service SHOULD returnapplication/json
. -
NOTE that
autocomplete
is a suggestion for supporting type-ahead search. In this version,autocomplete=true
andoptions.inline
are assumed compatible. That would mean the client would be in charge of rendering the type-ahead support. Is that acceptable? It's a big 'ask' for clients, I think.