Closed Malabarba closed 8 years ago
Hi @Malabarba, glad you find it useful!
It looks like the table routing change is in the latest master but isn't released yet - I presume it will be in 0.4.2.
The current implementation of defroutes
works from the terse pedestal routing syntax, and I see that is still supported in upcoming versions of pedestal. The table routing implementation may be able to emit the terse syntax - I haven't looked into it yet - in which case it could be supported with a small change in pedestal-api, but otherwise this would have to be supported in route-swagger.
@frankiesardo is this something you plan to look at?
FWIW, I believe I've got it to work by adding swagger doc to the interceptors, and then calling with-swagger
on the return value of route-table
.
From what I see the table syntax expands to the same data structure the terse syntax expands to, so route-swagger.doc/with-swagger
should still work and can already be used like
(def app-routes
(->
(table/route-table
{}
[["/user" :get user-search-form]
...
["/user/:user-id/profile" :put update-profile]])
(with-swagger {..}))
@oliyh you can have either have a separate entry point for the table expansion or just point out it still possible to use route-swagger directly if someone needs to.
@Malabarba well done, glad to hear it's working
@frankiesardo good that they both expand the same way, I will add a helper for table routes when pedestal 0.4.2 is released.
Good point about route-swagger still being available underneath, I'll make that clearer in the documentation, but it looks like @Malabarba already worked it out anyway!
Pedestal will accept any routing format supported by the Routing Definition API. defroutes
at this point is just a shorthand for syntax-quote. You shouldn't have to do anything special on your end, but if you need anymore information, feel free to reach out!
Hi there. First of all, thank you for this project.
I looked through the readme and docstrings, but couldn't find an answer for this. Does pedestal-api's
defroutes
support the table routing syntax seen here?If not, would you know an alternative way to "swagger" such routes?