[cbswagger-1.3.0+62] Using custom module handlers directory?

I have a ColdBox based REST API application where one of the modules has a custom handlers directory name set up. Accessing the API endpoints via the custom handlers directory works without issue.

Now, I am trying to wrap my head around ColdBox Relax and it appears that I need to pre-generate the Open API JSON for ColdBox Relax to use and it appears the cbswagger module is supposed to do that. I have dropped both modules into my app and when I hit /cfswagger, I get an error on the above mentioned module stating that ‘The handler at v1.handlers.home could not be parsed’. No, it can’t, because it exists at ‘v1.resources.home’.

I have been tracing through the code in cfswagger for a while now without much luck. Is there a configuration option somewhere I need to set for it to be able to use the correct handlers directory or is this an issue when using a custom handler directory convention?

Thanks,
– Jeff

Hi Jeff,

That’s a bug I’m going to have to fix in cbSwagger. I don’t think I ever considered a module with a non-convention handler directory and so I hard coded ‘.handlers’ when dealing with modules – hence your error. I will push up a fix for that over the weekend.

Other than that, cbSwagger should generate your JSON from the route and handler/action introspection.

For a quick fix, rename the resources handlers directory to handlers when you run /cbswagger and the JSON will be generated. Then move it back after you’re done.

Jon