This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-27
Channels
- # announcements (1)
- # aws (8)
- # babashka (77)
- # babashka-sci-dev (8)
- # beginners (29)
- # biff (2)
- # calva (13)
- # cljs-dev (1)
- # clojure (42)
- # clojure-europe (205)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojurescript (58)
- # conjure (9)
- # data-science (7)
- # datalevin (19)
- # datomic (3)
- # emacs (7)
- # fulcro (15)
- # gratitude (8)
- # lsp (52)
- # meander (3)
- # membrane (92)
- # off-topic (12)
- # re-frame (16)
- # reagent (4)
- # reitit (15)
- # releases (1)
- # sci (30)
- # shadow-cljs (34)
- # tools-deps (5)
- # xtdb (17)
What is the best way to write a malli spec for an empty 200 response in :responses
, like for successful authentication? {200 {:body any?}}
seems to work but I suppose there is a better way?
If I recall, Ring uses empty string ""
as empty response. So you could check that the response body value equals to ""
if that makes sense.
Or maybe it makes more sense to send an explicit HTTP204 “No Content” response in this case.
E.g. https://github.com/metosin/ring-http-response/blob/master/src/ring/util/http_response.clj#L74-L80
Dunno how much value the validation actually brings here. Unless you’re generating swagger from the routes & schemas.
Thanks! I considered using 204 but I think it may break my tests. I'm generating Swagger!
Hmm swagger docs encourage to leave the content
key undefined if empty response is expected https://swagger.io/docs/specification/describing-responses/
Perhaps if you don’t have any schema for the body it will be just fine for Swagger? 🙂
Please let me know if that works as expected. 🙂 Just throwing things from the top of my mind, didn’t test
Is it possible to provide a`:description` for tags
as specified in the Swagger docs in reitit? https://swagger.io/docs/specification/grouping-operations-with-tags/
"Optionally, you can specify description
and externalDocs
for each tag by using the global tags
section on the root level. The tag names here should match those used in operations."
Here’s an example how you can define / override what goes to the swagger spec https://github.com/metosin/reitit/blob/master/examples/ring-malli-swagger/src/example/server.clj#L25-L29
Thanks! I guess that it's not possible to add this "downstream" in the route data? My routes are collected from different namespaces and it would be great if tags could be described locally in each ns rather than at the top level.