spec-tools icon indicating copy to clipboard operation
spec-tools copied to clipboard

missing swagger support for `spec/coll-of`

Open slipset opened this issue 6 years ago • 1 comments

spec-tools.visitor has (defmethod visit-spec 'clojure.spec.alpha/coll-of ...) which ends up dispatching on

(case type
                   :map-of ::map-of
                   :set ::set-of
                   :vector ::vector-of)

while there is no implementation of accept-spec for any of #{::visitor/map-of, ::visitor/set-of, ::visitor/vector-of}

I've tried to add a

(defmethod swagger/accept-spec ::vector-of [_ _ children _]
  (println "CHILDREN-VECTOR-OF" (util/pp children))
  {:enum children :type "string"})

this prints CHILDREN-VECTOR-OF [{}]

This leads me to suspect that the implementation of visit-spec for clojure.spec.alpha/coll-of is flawed.

slipset avatar Mar 19 '19 16:03 slipset

If you have time to investigate & to fix, help would be most welcome.

ikitommi avatar Mar 27 '19 11:03 ikitommi