I want to extend an existing defresource
with additional decision.
Let's say that I have (note that this is not the actual code but an example to showcase what I am trying to do):
(defresource get-something [{:keys [service]} ctx]
resource-defaults
:allowed-methods [:get]
:authorized? (authorized? ctx)
:exists? (fn [_]
true)
:handle-ok (fn [{:keys [::result]}]
result))
then I want to "extend" get-something
with a additional decision, e.g
malformed? (fn [_] false)
By "extend" I mean add the decision to the workflow of the handler without modifying get-something
, thus obtaining a resource that uses all the decisions.
(resource
(get-something service ctx)
malformed? (fn [_] false))
Is it even possible?
In the end resource definitions are map and data and can be manipulated as such: