Skip to content

Commit 6242329

Browse files
committed
facts for #159, work ok with legal schema types. Primitive arrays depend on metosin/ring-swagger#56
1 parent 610fa44 commit 6242329

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

test/compojure/api/integration_test.clj

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,3 +1192,47 @@
11921192
{"/normal" irrelevant
11931193
"/extra" irrelevant
11941194
"/runtime" irrelevant})})))
1195+
1196+
;;
1197+
;; with supported schemas
1198+
;;
1199+
1200+
(s/defschema Foo {:a s/Str})
1201+
1202+
(defapi with-defapi
1203+
(swagger-docs)
1204+
(GET* "/foo" []
1205+
:return Foo
1206+
(ok {:a "foo"})))
1207+
1208+
(defn with-api []
1209+
(api
1210+
(swagger-docs)
1211+
(GET* "/foo" []
1212+
:return Foo
1213+
(ok {:a "foo"}))))
1214+
1215+
(fact "defapi & api define same results with supported schema types #159"
1216+
(get-spec with-defapi) => (get-spec (with-api)))
1217+
1218+
;;
1219+
;; with unsupported schemas
1220+
;;
1221+
1222+
(s/defschema Foo2 [s/Keyword])
1223+
1224+
(defapi with-defapi2
1225+
(swagger-docs)
1226+
(GET* "/foo" []
1227+
:return Foo2
1228+
(ok [:foo])))
1229+
1230+
(defn with-api2 []
1231+
(api
1232+
(swagger-docs)
1233+
(GET* "/foo" []
1234+
:return Foo2
1235+
(ok [:foo]))))
1236+
1237+
(fact "defapi & api define different results with unsuported schema types #159"
1238+
(get-spec with-defapi2) =not=> (get-spec (with-api2)))

0 commit comments

Comments
 (0)