jensoleg/swagger-ui

Method name instead of summary as heading

Closed this issue · 1 comments

ksved commented

I want to customize to put the method name instead of summary in the sidebar and the heading. Summary could instead be written just above description. How can I can do it?

You can do this by updating src/main/template/sidebar_item.handlebars to use the template you prefer. For example, I use this:

<span title='{{nickname}}'>
  <span class='http_method MyClass--label-{{method}}'>{{method}}</span>
  <span class="{{#if deprecated}}deprecated{{/if}}">{{path}}</span>
</span>

At the same time, update src/main/javascript/view/SidebarHeaderView.js to add method data to the renderable data. For my template (above) I need this around line 20:

item.method = this.model.operationsArray[i].method;
item.deprecated = this.model.operationsArray[i].deprecated;
item.encodedParentId = encodeURIComponent(this.parentId);
item.path = this.model.operationsArray[i].path;

You'll probably want to add CSS to style your new template.

Hope this helps!