siren-js / api-browser

Siren API browser that uses Siren.js
https://siren-js.github.io/api-browser/
MIT License
2 stars 0 forks source link

Support for “select” type #25

Open miller79 opened 1 year ago

miller79 commented 1 year ago

With support for the radio type to perform like a select drop-down box, support should also be added for the select type to perform similarly. Some thought may be needed to support multiple selections but as a version 1 supporting select one should be supported.

dillonredding commented 1 year ago

I don't see the value in supporting select as a way of getting a drop-down since that's semantically identical to radio. It makes no difference to a non-UI client either.

However, the idea of a multi-select is interesting. I can think of two options.

Option 1: Extension

We support a multiple extension on a radio field indicating whether to allow multiple selections. Downside is this is counterintuitive since radio heavily implies single choice.

Option 2: select Exclusively Multiple

Rather than require an extension, we assume a select field implies multiple. So, radio means the field's value is only one of the options' value, whereas select means the field's value is an array of zero or more of the options' value.

I personally prefer option 2 because it only defines semantics for a new field type and doesn't introduce a new extension.

miller79 commented 1 year ago

That’s fair. I think option 2 is the most practical.