How to customize the Swagger Documentation on Developer Portal

Hi @seshi

Is there a way to customize the fields what we see on Swagger API Documentation page on Developer Portal.

Suppose I take the example of Petstore swagger json. It generates the category based on tags and list all the methods as shown in screenshot attached.

Now as highlighted in RED if I need only the relative URL of the resource like (/user/logout) instead of absolute URL (https://petstore.swagger.wordnik.com:443/api/user/logout). Is it possible ?

Also what other customization are available on this page which we can use or customization on how we can see Swagger Documentation on Developer portal ?

Thanks

Gaurav

0 4 452
4 REPLIES 4

Not applicable

Hi @GAURAV

I guess you are referring to the resource Url that is being displayed. You can modify the smartdocs.hbr template and not print {{baseUrl}}, only print {{path}} variable.

Upload the new hbr template admin/config/smartdocs and re-render the Smartdocs model. Clear caches to see the new template for the API method page.

Hi @seshi

I modified the smartdocs.hbr template and clear the cache but it is not reflecting. I can still see the full URL including baseUrl and path

I modified the below lines and uploaded the same at admin/config/smartdocs under Advance Settings

Before at Line 61

{{#if baseUrl}} <span data-role="host">{{baseUrl}}</span>{{/if}}{{#if path}} <span data-role="path">{{path}}</span>{{/if}}

After

{{#if path}} <span data-role="path">{{path}}</span>{{/if}}

Please find the attached modified smartdocs.hbr template

Thanks

Gaurav

smartdocs.txt

Hi @GAURAV

Clearing the caches and re-render should help

Hi @seshi

Already done that couple of time but no luck.