Fork me on GitHub
#ring-swagger
<
2017-11-06
>
carocad10:11:37

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 /* 😕

carocad11:11:12

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

✅ 2
ikitommi12:11:23

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

carocad12:11:10

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

carocad12:11:22

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

carocad12:11:16

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

ikitommi12:11:28

Hmm.. sound fishy. let me test.

carocad12:11:36

thanks 🙂

ikitommi12:11:17

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

ikitommi12:11:10

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

ikitommi12:11:00

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

carocad12:11:57

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

carocad12:11:00

thanks @ikitommi your comments helped me figure out the confusion

ikitommi13:11:36

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