Could not associative array of (key, value) pairs.
mkrajcir opened this issue · comments
mkrajcir commented
I am missing the option to use key-value pairs in template for composite value consisting of an associative array of (name, value) pairs.
Expected template usage:
{&var*}
Expected variables having values of key-value pairs
var := [("one", "red"), ("two", "green")]
Expected output:
&one=red&two=green
According to RFC 5670:
2.4.2. Composite Values
An explode ("*") modifier indicates that the variable is to be treated as a composite value consisting of either a list of values or an associative array of (name, value) pairs.
Kyle Fuller commented
let template = URITemplate(template:"{&var*}")
let expanded = template.expand(["var": ["one": "red", "two": "green"]])
will render as &one=red&two=green