metosin / compojure-api

Sweet web apis with Compojure & Swagger
http://metosin.github.io/compojure-api/doc/
Eclipse Public License 1.0
1.11k stars 149 forks source link

Collection is being reversed by coll-of #406

Closed rlovtangen closed 5 years ago

rlovtangen commented 5 years ago

Library Version(s)

2.0.0-alpha27

Problem

Given a route like

(api/GET "/foo" []
      {:responses {status/ok {:schema ::int-list}}}
      (response/ok (list 1 2 3)))

with a spec like

(s/def ::int-list
  (su/spec
    (s/coll-of int?)
    {}))

the response returns the collection is reversed order:

$ curl -X GET --header 'Accept: application/json' 'http://localhost:8003/foo'
[3,2,1]

With version 2.0.0-alpha26 and earlier the collection keeps its original order:

$ curl -X GET --header 'Accept: application/json' 'http://localhost:8003/foo'
[1,2,3]
ikitommi commented 5 years ago

sorry for the lag, this is a bug.

ikitommi commented 5 years ago

found a fix for this in spec-tools.