Fork me on GitHub
Braden Shepherdson04:07:02

I'm getting completely swamped with DEBUG warning messages in my repl and can't see any of my own debugging.

Braden Shepherdson04:07:54

but I can't figure out how to control the logging level.

Joe Lane13:07:07

@braden.shepherdson logback.xml under the config directory if memory serves me right.


I like the swagger-ui route luminus provides but I want to switch to pedestal... what's an approach to integrating swagger into pedestal so that I can get a swagger ui webpage? I looked online but the various projects I happened across don't seem maintained (but please refer them anyway in case I missed one).


it seems like a nice all around pedestal based service might provide both the ability to listen to a queue and do things with that as well as have a REST interface with a user interface web page (I know that's probably a lot of things to put into every service but would allow for maximum flexibility and team access).

Braden Shepherdson15:07:25

@joe.lane ah, I had such a file generated but couldn't see why it wasn't being picked up. turns out it needs to be in the classpath. I added it to my boot, and now I'm not drowning in messages anymore.

👍 4
Braden Shepherdson15:07:45

my new problem is that I can't get the ::http/routes (fn [] ...) style to work. that spews errors about trying to use nil as an interceptor. the docs suggest this is allowed, and I'm hoping that doing (route/expand-routes (deref #'service/routes)) will make it dynamic for REPL based development.

Braden Shepherdson15:07:42

but even just replacing my (route/expand-routes service/routes) (which works) with #(route/expand-routes service/routes) fails.


@braden.shepherdson if you are passing the service map through io.pedestal.http/default-interceptors you don’t need to explicitly expand routes unless :io.pedestal.http/routes is a fn


Also, the service template using ::server/routes #(route/expand-routes (deref #'service/routes)) in run-dev to facilitate local dev


so that should work for you


I don’t recommend using a fn for routes outside of dev because it’s evaluated on every request

Braden Shepherdson16:07:44

yeah, I'm trying to do the same as the template (I'm using boot, not lein, so I didn't use the template directly) and I get a convoluted error when I pass a function.


hrm, and you are doing ::server/routes #(route/expand-routes (deref #'service/routes))?

Braden Shepherdson16:07:09

yes. as far as I can tell I'm running exactly the same setup as the template.

Braden Shepherdson17:07:05

even just (fn [] service/routes) explodes.


well I don’t expect that to work

Braden Shepherdson17:07:19

while service/routes unwrapped works.


because the routes are not expanded

Braden Shepherdson17:07:00

well, (fn [] (route/expand-routes service/routes) fails too.


io.pedestal.http/default-interceptors will create the routing interceptor for you and, if :io.pedestal.http/routes is not a fn, it will expand it.


what does service/routes look like?

Braden Shepherdson17:07:31

I've removed all of my routes from it.


because that should work

Braden Shepherdson17:07:38

so it's just the template now.

Braden Shepherdson17:07:30

that's what I've got.


hrm, Without seeing code I can’t determine why it’s not working. What I pasted works in a freshly generated service.

Braden Shepherdson17:07:25

Pedestal 0.5.7, Clojure 1.9.0, and I restarted my REPL for good measure.

Braden Shepherdson17:07:40

I'm diffing the files looking for variations.

Braden Shepherdson17:07:59

there! I figured it out with the diff. I had shuffled some pieces between files, and then put them back. my routes had

; where they needed

Braden Shepherdson17:07:46

which produces no error, but of course those symbols are not defined.

Braden Shepherdson17:07:14

thanks for the help debugging. I'm new to Pedestal and struggling, as always with a new framework, to figure out the right incantations for the magic.

Braden Shepherdson17:07:11

the sad part of this is that I'm debugging this side project during my 90-second builds at work. it just underscores the insane productivity of Clojure that I can reload things into my REPL with vim-fireplace and it's already live in my server.

Braden Shepherdson17:07:05

it's mind-boggling that people object to parens and dynamic types when those are the two dev experiences.

💯 8