Fork me on GitHub
#liberator
<
2017-06-15
>
nblumoe08:06:20

@ordnungswidrig is this still valid regarding auth in Liberator? https://stackoverflow.com/a/14187220/791795 I would like to use JWT.

ordnungswidrig09:06:30

Yes, that's still fine. Simply implement authentication and authorization in :authorized. Have done that with JWT before and it worked. :-)

nblumoe10:06:59

great thank, going to proceed like that then.

pandeiro20:06:02

How can I coerce database UUIDs to strings when a resource is being requested as JSON? (but not otherwise)

pandeiro20:06:34

I've come up with a very wonky function that check (get-in ctx [:representation :media-type]) and walks the resource data structure, converting UUIDs whenever found. But I wish Clojure JSON libs had support for the #uuid type 😕

pandeiro20:06:05

IMO there's a clear >90% case, just like how they deal with keywords: make it a string

ordnungswidrig21:06:52

You can specify a custom :as-response function that checks if the media type is JSON and creates a string with whatever JSON lib you want. For all other cases delegate to liberator's stock as-response implementation. See @pandeiro 's answer on where the media-type is in the context.