ataraxy icon indicating copy to clipboard operation
ataraxy copied to clipboard

Destructuring route params into a map

Open RickMoynihan opened this issue 6 years ago • 0 comments

Currently ataraxy only supports destructuring route parameters into a vector; often I find myself having to translate these parameters immediately into a map so I can attach specs to their keys and not have to remember a specific ordering.

It would be nice if ataraxy supported the following mapping, allowing parameters to be bound into a map.

["/path" #{foo bar ?baz}] [:foo/handler {:foo foo, :bar bar, :baz baz}]

One difficulty is that we'd have to decide what to do with optional parameters. It seems there are two options, either:

  1. the parameter ?baz is bound in the map to the kv pair of :baz nil, or...
  2. the key :baz is not put in the map at all.

Personally I think that 2 is the better approach, but it might be counter to peoples expectations.

RickMoynihan avatar Jul 25 '17 09:07 RickMoynihan