Closed honzajavorek closed 7 years ago
Please notice this comment from the authors of the uri-template
library: https://github.com/grncdr/uri-template/issues/17#issuecomment-324020852
I'm sorry for the mess, multi
is correctly interpreted as foo=bar&foo=bar
. I confused it with csv
. This issue is irrelevant.
When Swagger contains
array
URI parameter:Then the adapter creates an URI template, which looks like this:
If the uri-template library is provided with such template and with
[ 'sweet', 'spicy' ]
as a value forflavour
, it produces following URI:If the uri-template library is provided with template
/honey{?flavour}
and with[ 'sweet', 'spicy' ]
as a value forflavour
, it produces following URI:That made me read the RFC and it looks like the interpretation of how a variable should get expanded in this case is quite vague. The spec says it depends on a context. IMHO this is a problem, because user clearly specified
collectionFormat: multi
, which is a comma-separated list of strings. The Swagger adapter's interpretation of this in form of URI template is more vague though and allows subsequent tooling (uri-template
library) to expand it in a different way. Also, if I wanted to manually take care of this in Dredd, I'm out of luck, because I have no access to anything else then the vague template.I looked up tests of the
uri-template
library and found this, which looks like both templates should end up as comma-separated lists. However, when I try this in REPL, it consistently works as described above, not as written in the test.