tbh, I use compojure-api so I don't have to write a swagger.json file
I expressed that opinion on HN and was astounded to learn that there are people who write that file by hand
I would like to create my own metadata handler named :filter which would extract common filters from query-params so I don't have to repeat it in every GET endpoint. However I got stucked on No method in multimethod 'restructure-param' for dispatch value: :filter
(defmethod restructure-param :filter
[_ binding acc]
(update-in acc [:letks] into [binding `(:query-params ~'+compojure-api-request+)]))
you have :filters
instead of :filter
in your defmethod
typo, I've edited it - it's not working anyway
I guess you should use proper namespace compojure.api.meta
: https://github.com/metosin/compojure-api/wiki/Creating-your-own-metadata-handlers#example
[compojure.api.meta :refer [restructure-param]]
that's what I am using 🙂
do you have the ns with the custom restructuring imported from all namespaces where it is used? mms have global state.
having that code evaluated once before any routes are resolved works. But with tools-refresh & repl, the multimethod can end up in a dirty state.
would be cool If clojure had scoped mms & protocols.
@ikitommi yes, that solved it, thanks a lot 🙂