: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"})
?
yes, im not sure what the corresponding json schema type is though 🙂
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
https://github.com/metosin/compojure-api/wiki/Swagger-aware-File-uploads
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