Fork me on GitHub
#pedestal
<
2019-04-11
>
macrobartfast16:04:53

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

martinklepsch16:04:01

@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?)

macrobartfast16:04:24

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)...

macrobartfast16:04:46

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

martinklepsch16:04:41

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

martinklepsch16:04:07

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

macrobartfast16:04:24

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

martinklepsch16:04:24

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

macrobartfast16:04:21

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.

martinklepsch16:04:56

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

martinklepsch16:04:16

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

macrobartfast16:04:46

ah, so #reitit is an alternative to pedestal?

macrobartfast16:04:03

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

martinklepsch16:04:45

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. 😄

👍 4
martinklepsch16:04:20

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

martinklepsch16:04:38

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

macrobartfast16:04:39

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

martinklepsch16:04:14

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

macrobartfast16:04:59

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.

macrobartfast16:04:21

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

macrobartfast16:04:53

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.

martinklepsch16:04:30

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

macrobartfast20:04:40

ok... will do!

macrobartfast20:04:17

that works perfectly.

macrobartfast20:04:30

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

martinklepsch16:04:31

yeah that can indeed be a bit tricky in the beginning

ikitommi17:04:14

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

ikitommi17:04:33

@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.

👍 8
mtnygard17:04:52

@ikitommi That's very cool.

macrobartfast20:04:57

awesome... trying all this now.