ring-swagger

ring-swagger & compojure-api
2017-11-06T10:00:37.000438Z

hey guys, quick question: is the not found advice at the end still valid? I am using compojure-api 2.0.0-alpha7 and that didnt work for me. I got it to work using an ANY handler with /* 😕

2017-11-06T11:20:12.000034Z

unfortunately by doing that I get a validation schema error from swagger => attribute paths.'/*'. is unexpected"

ikitommi 2017-11-06T12:10:23.000175Z

@carocad hi. can’t recall what was the not found advice… but I think this is still valid: https://github.com/weavejester/compojure#usage

2017-11-06T12:13:10.000164Z

@ikitommi thanks for the answer. What I am trying to do is to create a 404 handler for any request that doesnt match any handler.

2017-11-06T12:14:22.000342Z

unfortunately the not-found function is not called if I use it inside the compojure.api.sweet/api function. Is this a bug?

2017-11-06T12:15:16.000183Z

I havent tried it with a raw compojure server though. I had to do it that way because the server throws a NullPointerException otherwise

ikitommi 2017-11-06T12:15:28.000259Z

Hmm.. sound fishy. let me test.

2017-11-06T12:15:36.000182Z

thanks 🙂

2017-11-06T12:16:23.000208Z

here is our handler creation, if it helps https://github.com/hiposfer/kamal/blob/master/src/hiposfer/kamal/server.clj#L24

ikitommi 2017-11-06T12:19:17.000100Z

created a project from template and added (route/not-found "<h1>Page not found</h1>") into the end. works ok here.

ikitommi 2017-11-06T12:20:10.000267Z

compojure-api warns about non-documented route thou, wrapping that with undocumented removes the warning.

ikitommi 2017-11-06T12:21:00.000320Z

also, you could do that outside of an api: (let [app (some-fn (create grid) (route/not-found “<h1>Page not found</h1>“))] ...)

2017-11-06T12:24:57.000302Z

ah I found the error. There is a not-found function from compojure and there is another not-found function from compojure-api. I was mixing the two so it was not recognized

2017-11-06T12:26:00.000094Z

thanks @ikitommi your comments helped me figure out the confusion

ikitommi 2017-11-06T13:31:36.000370Z

np. And yes, there is the ring.util.http-response/not-found which easily get’s exported in..