Fork me on GitHub
#ring-swagger
<
2015-08-26
>
shaym11:08:44

hi, i am trying to spread my routes over multiple files but i swagger is not recognizing some of my routes , here is an example http://paste.ubuntu.com/12198637/

shaym11:08:09

the first version uses a var to store the route def

shaym11:08:33

and then the route doesnt show in swagger panel

shaym11:08:51

@juhoteperi: is there a specific way to do this?

juhoteperi11:08:29

shaym: defroutes*

juhoteperi11:08:39

Readme only mentions it in relation to legacy routes but it should be used also when you are defining routes in several places

shaym11:08:24

deraen: cool trying it now

shaym11:08:15

deraen: great it works , thanks !

shaym11:08:55

deraen: how does using the defroutes macro differ from simply including the var?

juhoteperi11:08:46

@shaym: Defroutes walks through the code to collect route data and associates that to var metadata

shaym11:08:44

@juhoteperi: and defapi doesnt do it when there is an indirection via a var ?

juhoteperi11:08:15

Or rather, it stores the source code of route to var metadata so that when defapi encounters a var it can read the original source code and use that for the route collection

juhoteperi11:08:49

With normal def the route is evaluated so defapi would be unable to parse the original source code

shaym11:08:07

deraen: good to know , I still have a lot to learn about macros

shaym11:08:21

deraen: thanks again!

juhoteperi11:08:55

I’m not sure if Compojure-api is the best place to look for macro examples. I’m thinking, it does lots of things better avoided if possible 😄