pedestal

macrobartfast 2019-04-11T16:30:53.029500Z

can anyone recommend a swagger integration for pedestal? I need to create a rest service with a swagger gui for front end devs.

martinklepsch 2019-04-11T16:33:01.029900Z

@macrobartfast are you already using pedestal or do you want to use pedestal for that? (i.e. would the rest service be a fresh project?)

macrobartfast 2019-04-11T16:34:24.031500Z

well, I was using luminus, mainly because that's how I had learned to generate a rest backend with swagger... but I didn't actually need the website features of luminus, and I know pedestal is what I should be using for my services (better for microservices, etc)...

macrobartfast 2019-04-11T16:34:46.032Z

but I'm a bit challenged figuring out how to get the swagger ui going in pedestal.

martinklepsch 2019-04-11T16:35:24.032200Z

well there's this https://github.com/frankiesardo/route-swagger

martinklepsch 2019-04-11T16:35:41.032800Z

but also consider #reitit where swagger is part of the package

martinklepsch 2019-04-11T16:36:07.033500Z

it shares a lot of the conceptual ideas with pedetal (interceptors at the very least)

macrobartfast 2019-04-11T16:36:24.034100Z

it seems like reitit the popular thing now, so I may as well learn that approach.

martinklepsch 2019-04-11T16:36:24.034200Z

so depending on where you are in your project it might be worth considering

macrobartfast 2019-04-11T16:37:21.035900Z

and of course, I'm always worried about things with repos that were last updated several years ago... and I know that they may have not been updated because they 'are stable and don't need updating'... but it's always a bit unnerving.

martinklepsch 2019-04-11T16:37:56.036700Z

pedestal is doing fine, I use it a lot and would happily pick it again

martinklepsch 2019-04-11T16:38:16.037400Z

just thought that because you have that swagger requirement it might be worth mentioning reitit

macrobartfast 2019-04-11T16:38:46.038100Z

ah, so #reitit is an alternative to pedestal?

macrobartfast 2019-04-11T16:39:03.038600Z

I thought it was going to be part of pedestal or something.

martinklepsch 2019-04-11T16:39:45.039500Z

in Clojure stuff you generally shouldn't care about when stuff was updated last, if it works it's kind of going to work "forever" because Clojure is so stable. Literally the most breakage I've seen without code changes has occurred due to changes in the JVM. 😄

1👍
martinklepsch 2019-04-11T16:40:20.040700Z

I think you can also combine the two but probably easier to just use one

martinklepsch 2019-04-11T16:40:38.041400Z

Also reitit is the default thing in the new Luminus so if you're familiar with that might be worth looking there for more info

macrobartfast 2019-04-11T16:40:39.041600Z

ah ok... so I'll go with frankiesardo/route-swagger and pedestal to dive into, on your recommendation.

martinklepsch 2019-04-11T16:41:14.042600Z

not sure if Luminus has an "API" option that would generate some of that setup code for you

macrobartfast 2019-04-11T16:41:59.043600Z

I think I should go with pedestal over luminus in general, if only because it seems like a better thing to learn for enabling microservices to be able to talk to each other.

macrobartfast 2019-04-11T16:43:21.044500Z

and that said I guess the luminus reitit would also possibly do that.

macrobartfast 2019-04-11T16:44:53.046Z

it's just hard for folks like me to just get beyond figuring out which frameworks/libraries (I'm not even sure what to call them) to use lol.

martinklepsch 2019-04-11T16:58:31.047100Z

yeah that can indeed be a bit tricky in the beginning

martinklepsch 2019-04-11T16:59:30.047200Z

lein new luminus myapp +reitit +swagger +service
I think I'd recommend you to take a look at what this generates and see if it fits your need

ikitommi 2019-04-11T17:12:14.048700Z

#reitit has first-class support for pedestal, here's a sample (with swagger): https://github.com/metosin/reitit/tree/master/examples/pedestal-swagger

ikitommi 2019-04-11T17:20:33.052200Z

@macrobartfast In short: you swap the default pedestal router into reitit one (with a helper fn) and start using it. Besides swagger, it adds spec & schema coercion, and lot of other things.

2👍
mtnygard 2019-04-11T17:24:52.052400Z

@ikitommi That's very cool.

macrobartfast 2019-04-11T20:42:40.052800Z

ok... will do!

macrobartfast 2019-04-11T20:45:57.053100Z

awesome... trying all this now.

macrobartfast 2019-04-11T20:57:17.053200Z

that works perfectly.

macrobartfast 2019-04-11T20:57:30.053400Z

I will also learn the other options, for different use cases.