yada

stijn 2018-11-06T19:42:14.047400Z

hi, let's say I have an API that has produces both application/json and application/edn. In case of an application/json response, i would like to update the response to strip namespaces from keywords. how would I implement this in a clean way in yada? I can walk the bidi tree and look at each methods :response function, and adapt that based on the negotiated content-type, but isn't there a less 'invasive' way?

malcolmsparks 2018-11-06T19:44:05.048900Z

I'm not clear what you're asking

stijn 2018-11-06T19:44:20.049300Z

oh, and I only want it to happen for /api/v2 e.g. and not for /api/v1 (so no yada-wide setting by overriding e.g. render-map and render-seq)

malcolmsparks 2018-11-06T19:44:44.050200Z

You can ask in a response function what the negotiation is

stijn 2018-11-06T19:45:26.051Z

ok, I think that I will use that indeed

malcolmsparks 2018-11-06T19:45:48.052Z

Are you trying to do the same logic for many web resources?

stijn 2018-11-06T19:45:54.052200Z

yes

stijn 2018-11-06T19:46:14.052900Z

so walking the bidi routes and then wrapping the :response function should work

malcolmsparks 2018-11-06T19:46:29.053400Z

You could add an interceptor after the response function interceptor

stijn 2018-11-06T19:46:41.053800Z

ok, that's another idea

stijn 2018-11-06T19:46:54.054500Z

yes, that'll probably be better 🙂

malcolmsparks 2018-11-06T19:46:59.054700Z

But yes, decorating the response function is a fine approach too

stijn 2018-11-06T19:47:24.054900Z

thanks!