File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 494494 :type " void" }]
495495 :path " /user" }]})))
496496
497+
498+ (facts " swagger-docs with Return and Body models"
499+ (defapi api
500+ (swagger-docs )
501+ (swaggered +name+
502+ (POST* " /echo" []
503+ :return {:a String}
504+ :body [_ {:a String}]
505+ identity)))
506+
507+ (fact " api-docs"
508+ (let [[status body] (get* api (str " /api/api-docs/" +name+) {})]
509+
510+ (fact " are found"
511+ status => 200 )
512+
513+ (let [operation (-> body :apis first :operations first)
514+ body-parameter-type (-> operation :parameters first :type keyword)
515+ return-type (-> operation :type keyword)]
516+
517+ (fact " generated body-param is found in Models"
518+ body-parameter-type => truthy
519+ (-> body :models body-parameter-type) => truthy)
520+
521+ (fact " generated return-param is found in Models"
522+ return-type => truthy
523+ (-> body :models return-type) => truthy)))))
524+
497525(fact " swagger-docs works with the :middlewares"
498526 (defapi api
499527 (swagger-docs )
Original file line number Diff line number Diff line change 22 (:require [compojure.api.core :refer :all ]
33 [compojure.api.swagger :refer :all ]
44 [compojure.core :refer :all ]
5- [midje.sweet :refer :all ]))
5+ [midje.sweet :refer :all ]
6+ [schema.core :as s]))
67
78(fact " extracting compojure paths"
89
You can’t perform that action at this time.
0 commit comments