Closed smn closed 2 years ago
Hi @smn , definitely agreed. Check out version 1.0.0-rc3 of the specification: https://floip.gitbook.io/flow-specification/v/drafts%2F1.0.0-rc3/layers/blocks-2#select-one-response-multiple-choice-question-block
Version rc3 changes choices to an array of choice objects, with properties name
, prompt
, and test
. It also has much better support for mapping raw responses from end-users to choice selections, via the test
property.
For your current work, are you following 1.0.0-rc3? The changelog is here, and there are some important sanity upgrades in it.
Thank you! Will follow rc3 for this, thanks!
The SelectOneResponse block definition states that the
config
should have achoices
key with a mapping of tags to localized names for choices. The implementation uses a JSON object for the mapping. This is problematic because the JSON specification states thatAn object is an unordered set of name/value pairs
.Some languages may load these keys in the order that they're defined but that should be seen as a unintended side effect.
The language we're using translates JSON objects to Map structures of which the key order is non-deterministic. The unintended side effect of this is that when we're surfacing a
SelectOneResponse
as a multiple choice menu, the order of the choices is different from what the floip specification suggests.Is there appetite to change the
choices
config to a list of objects with predictable keys or a list of tuples?The current example from the documentation is
My suggestion would be to either go with a list of objects:
Or a list of tuples:
There may be other areas where the spec is implicitly assuming that the order of keys in JSON Objects is stable.