@ikitommi i tracked it down to this function https://github.com/metosin/compojure-api/blob/6d705dd4e08d3a55c55080eab94a00161473910f/src/compojure/api/coercion/spec.clj#L57
which one in-turn calls https://github.com/metosin/spec-tools/blob/d0137de90420cd95f40efcff78f3710bcbaf92f4/src/spec_tools/data_spec.cljc#L89
that registers a spec that no longer has the :decode/string
this gave me the hunch that the following should work - and it does!
(def user-ids-spec
(st/spec
{:spec (s/coll-of ::corespec/user-id)
:description "comma separated list of user-ids"
:json-schema/type {:type "string"}
:json-schema/example "1,2,3"
:decode/string #(cs/split %2 #",")
:encode/string #(cs/join %2 ",")}))
(context "/v1" []
:coercion :spec
(GET "/events" []
:coercion :spec
:query-params [user-ids :- user-ids-spec]
(println "foo" (pr-str {} user-ids 30)))))
i.e. instead of registering result of st/spec
with s/def
i am just referencing it in the :query-params specificationLet me know if you want me to open an issue or update the docs somewhere.
what is different with that code? looks the same as the original?
oh, the s/def
… sounds like a bug to me.
but glad you got it working!
should i open a PR for a change in -map-spec?
sure, please do