tink_web icon indicating copy to clipboard operation
tink_web copied to clipboard

Dynamic parameter names

Open kevinresol opened this issue 6 years ago • 3 comments

@:params(bar('bar-$_') in query)
function get(bar:DynamicAccess<String>);

and a request with ?bar-foo=a&bar-baz=b would be translated to {foo:'a', baz:'b'} in Haxe.

Any thoughts?

kevinresol avatar Feb 11 '19 16:02 kevinresol

Well, the main problem here is parsing DynamicAccess, which is currently unsupported. It'll require restructuring how the data is stored in the parser, because getting maps from a flat key-value-list is not that easy. Especially if you consider more complex cases like DynamicAcces<String, { ?foo:String, ?bar:Int }>.

back2dos avatar Feb 11 '19 16:02 back2dos

Query string is only part of the problem. I also want this to work with request headers. (Thanks to aws)

kevinresol avatar Feb 11 '19 16:02 kevinresol

Yeah, but headers are basically a key-value list too ... both get parsed via tink_querystring, which despite its name is not that query string specific ^^

back2dos avatar Feb 11 '19 16:02 back2dos