Fork me on GitHub
#ring-swagger
<
2017-11-14
>
bja15:11:45

tbh, I use compojure-api so I don't have to write a swagger.json file

bja15:11:11

I expressed that opinion on HN and was astounded to learn that there are people who write that file by hand

petr.mensik15:11:47

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+)]))

jumar15:11:00

you have :filters instead of :filter in your defmethod

petr.mensik15:11:46

typo, I've edited it - it's not working anyway

petr.mensik16:11:49

[compojure.api.meta :refer [restructure-param]] that's what I am using 🙂

ikitommi16:11:46

do you have the ns with the custom restructuring imported from all namespaces where it is used? mms have global state.

ikitommi16:11:34

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.

ikitommi16:11:23

would be cool If clojure had scoped mms & protocols.

petr.mensik19:11:48

@ikitommi yes, that solved it, thanks a lot 🙂