[Coldbox 4.3.0], [Relax 3.0.1+121],[Swagger 1.0.2-snapshot] Generating Swagger JSON

Hello-

I am working in the relax module and would like to move away from the Relax Programmatic DSL. I have installed cbswagger module but cannot figure out how to actually use it to export my API JSON using the auto-discovery. If I use a Relax.cfc it asks for it to point to an existing JSON file or using the DSL in the actual Relax.cfc. I am just wondering how I get that JSON created based on the metadata in my API?

On https://coldbox-relax.ortusbooks.com/cbswagger-companion-module.html it says “cbSwagger will automatically introspect your API handlers provided by your routing configuration” How do I do this?

Any help would be much appreciated!

Thanks,
Matt

Hi Matt,

Once you install the `cbSwagger` module, then go to your app using `/cbswagger` That will export your API as a swagger json document.

Luis Majano
CEO
Ortus Solutions, Corp

Support Our Open Source Projects: www.patreon.com/ortussolutions
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/lmajano

Thank you Luis! I figured it was something simple I was missing. I was
trying to access the swagger-sdk thinking that was the module. I installed
the cbswagger module and have it working. I think I found a bug though:

File: Models\RoutesParser.cfc
Line: 103 should just be: route[ "moduleInvocationPath" ] =
moduleConventionPath;

as it is now...trying to listToArray an array:

var moduleConventionPath = listToArray(
variables.controller.getColdboxSettings().modulesConvention, "/" );
arrayAppend( moduleConventionPath, route.module );
route[ "moduleInvocationPath" ] = listToArray( moduleConventionPath, "." );
If you prefer I can put in the ticket...just need tracker URL...

Thanks again,
Matt