Closed
Description
When using compojure-api 0.22.2 (and 0.22.1), I expect no difference between the following applications:
(ns foobar.handler
(:require [compojure.api.sweet :refer :all]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
[schema.core :refer [defschema] :as schema])
(:import [clojure.lang Keyword]))
(defschema Foo
[schema/Keyword])
(defschema Bar
[Keyword])
(defapi app-routes
(swagger-docs {:info {:title "FooBar"}})
(GET* "/foo" []
:return Foo
(constantly [:foo :is :great]))
(GET* "/bar" []
:return Bar
(constantly [:bar :is :better]))
(route/not-found "Not Found"))
(def app
(wrap-defaults app-routes site-defaults))
and
(ns foobar.handler
(:require [compojure.api.sweet :refer :all]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
[schema.core :refer [defschema] :as schema])
(:import [clojure.lang Keyword]))
(defschema Foo
[schema/Keyword])
(defschema Bar
[Keyword])
(defn app-routes
[]
(api
(swagger-docs {:info {:title "FooBar"}})
(GET* "/foo" []
:return Foo
(constantly [:foo :is :great]))
(GET* "/bar" []
:return Bar
(constantly [:bar :is :better]))
(route/not-found "Not Found")))
(def app
(wrap-defaults (app-routes) site-defaults))
However, when running them and inspecting the generated swagger.json, the second version, not using defapi, contains this definition for Foo:
"schema": {
"type": "array",
"items": null
},
"description": ""
when items should be of type "string".
For now, our workaround is to use clojure.lang.Keyword which works within defapi or within a plain api call.
Metadata
Metadata
Assignees
Labels
No labels