This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-28
Channels
- # ai (1)
- # beginners (239)
- # bitcoin (1)
- # boot (4)
- # cider (5)
- # clara (3)
- # cljs-dev (16)
- # cljsjs (5)
- # cljsrn (1)
- # clojure (152)
- # clojure-android (3)
- # clojure-dev (3)
- # clojure-greece (4)
- # clojure-italy (5)
- # clojure-spec (14)
- # clojure-uk (24)
- # clojurescript (81)
- # data-science (1)
- # datomic (47)
- # devcards (34)
- # docs (3)
- # emacs (6)
- # ethereum (1)
- # events (9)
- # flambo (5)
- # fulcro (11)
- # graphql (1)
- # immutant (3)
- # lein-figwheel (2)
- # leiningen (2)
- # luminus (6)
- # lumo (90)
- # off-topic (25)
- # proton (2)
- # re-frame (44)
- # reagent (5)
- # ring (7)
- # ring-swagger (11)
- # shadow-cljs (11)
- # spacemacs (6)
- # vim (13)
- # yada (25)
:return java.io.File
produces "ERROR don't know how to convert class java.io.File into a Swagger Schema. Check out ring-swagger docs for details.
java.lang.IllegalArgumentException: don't know how to convert class java.io.File into a Swagger Schema. Check out ring-swagger docs for details." I'm on [metosin/compojure-api "2.0.0-alpha5"]
@daveliepmann you can probably extend JsonSchema protocol to convert your type (File) into JSON schema, check out https://github.com/metosin/ring-swagger#schema-to-swagger-json-schema-conversion
@sammikko so something like :return (defmethod ring.swagger.json-schema/convert-class java.io.File [_ _] {:type "file"})
?
Me neither—I think Swagger expects "file". Regardless, I'm still getting an error when running the Swagger UI, which makes me suspect something is borked in how I set it up.
@daveliepmann Ring-swagger has existing schemas for Files
ring.swagger.upload/TimeFileUpload
@juhoteperi that's for uploads and therefore is defined to have stuff like a tempfile
key that I believe makes it not appropriate for a response schema, which is what I need.
Oh right
@daveliepmann sorry, didnt read your example right.. just leave java.io.File under :response and you have to call (defmethod ring.swagger.json-schema/convert-class java.io.File [ ] {:type "file"}) only once before ring swagger stuff gets called.. it kind of registers your extension of the multimethod