Fork me on GitHub

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.


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


Perhaps if you don’t have any schema for the body it will be just fine for Swagger? 🙂


I'll try that out!

👍 1

Please let me know if that works as expected. 🙂 Just throwing things from the top of my mind, didn’t test

👍 1

:responses {200 {}} works fine with swagger!

💪 1

Is it possible to provide a`:description` for tags as specified in the Swagger docs in reitit? "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

🙏 1

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.


I think you can place :swagger {:tags ...} under any routes and reitit will collect & merge them. (again from the top of my head and didn’t try)