Hello. How to setup retitit-swagger to group APIs under different group names? Is there a piece of code sample? THX!๐
@eric.shao Hello. Here's,a sample: https://github.com/metosin/reitit/blob/master/examples/ring-malli-swagger/src/example/server.clj#L55
should it be (spec-tools.core/spec โฆ)
instead?
@ikitommi ๐Thank you for your reply. I donโt describe clear, Is there a way to have a Two-level Group? A big group contains many secondary groups.
uthere is no such thing in swagger, but we have used tag names like admin
, admin.users
, admin.products
etc. Flat, but looks nested.
You could post an issue asking this into swagger-ui repo, if there would be such a grouping available nowadays, please paste the result here too.
Maybe gen many swagger spec?
๐Thank you @ikitommi for your reply.
oh, forgot, there is also https://cljdoc.org/d/metosin/reitit/0.4.2/doc/ring/swagger-support#multiple-swagger-apis
e.g. you can easily groups the apis into separate swagger specs too.
:hugging_face: Thank you!!!
Hi
I cant seem to get this example to work
["/upload"
{:post {:summary "upload a file"
:parameters {:multipart [:map [:file reitit.ring.malli/temp-file-part]]}
:responses {200 {:body [:map [:name string?] [:size int?]]}}
:handler (fn [{{{:keys [file]} :multipart} :parameters}]
{:status 200
:body {:name (:filename file)
:size (:size file)}})}}]
im using
[metosin/reitit "0.4.2"]
do you have the multipart-middleware mounted?
The middleware seems to be "the problem"
yes
{:middleware [;; query-params & form-params
parameters/parameters-middleware
;; content-negotiation
muuntaja/format-negotiate-middleware
;; encoding response body
muuntaja/format-response-middleware
;; exception handling
exception/exception-middleware
;; decoding request body
muuntaja/format-request-middleware
;; coercing response bodys
coercion/coerce-response-middleware
;; coercing request parameters
coercion/coerce-request-middleware
;; multipart params
multipart/multipart-middleware]
:muuntaja formats/instance
that is directly from the example project?
["/api"
{:middleware [;; query-params & form-params
parameters/parameters-middleware
;; content-negotiation
muuntaja/format-negotiate-middleware
;; encoding response body
muuntaja/format-response-middleware
;; exception handling
exception/exception-middleware
;; decoding request body
muuntaja/format-request-middleware
;; coercing response bodys
coercion/coerce-response-middleware
;; coercing request parameters
coercion/coerce-request-middleware
;; multipart params
multipart/multipart-middleware]
:muuntaja formats/instance
:coercion malli-coercion/coercion
No
just copied that endpoint
will test the project
it seems like the middleware is not adding the :multipart parameter
because if i ignore the middleware and i hit :multipart-param directly I do see the file
Just tested the example project and it works ok.
try adding the :reitit.middleware/transform reitit.ring.middleware.dev/print-request-diffs
router option
Thanks this really helped me understand lots of things
should print whatโs going on.
cool thanks will try