forked from loafle/openapi-generator-original
Generation of operations with multiple tags has been fixed #356
This commit is contained in:
parent
70c14092f9
commit
b0d2d1116b
@ -1,6 +1,7 @@
|
||||
package com.wordnik.swagger.codegen.languages;
|
||||
|
||||
import com.wordnik.swagger.codegen.*;
|
||||
import com.wordnik.swagger.models.Operation;
|
||||
import com.wordnik.swagger.models.properties.*;
|
||||
import com.wordnik.swagger.util.Json;
|
||||
|
||||
@ -8,6 +9,7 @@ import java.util.*;
|
||||
import java.io.File;
|
||||
|
||||
public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
private static final String ALL_OPERATIONS = "";
|
||||
protected String invokerPackage = "com.wordnik.client";
|
||||
protected String groupId = "com.wordnik";
|
||||
protected String artifactId = "swagger-client";
|
||||
@ -76,4 +78,20 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||
List<CodegenOperation> opList = operations.get(ALL_OPERATIONS);
|
||||
if(opList == null) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
operations.put(ALL_OPERATIONS, opList);
|
||||
}
|
||||
for (CodegenOperation addedOperation: opList){
|
||||
if (addedOperation.operationId.equals(co.operationId) && addedOperation.path.equals(co.path) && addedOperation.httpMethod.equals(co.httpMethod)) {
|
||||
addedOperation.tags.addAll(co.tags);
|
||||
return;
|
||||
}
|
||||
}
|
||||
opList.add(co);
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
{{#operations}}{{#operation}}
|
||||
<div class="method">
|
||||
<div class="method-path"><pre class="{{httpMethod}}"><code class="huge"><span>{{httpMethod}}</span>: {{path}}</code></pre></div>
|
||||
<div class="method-tags"> {{#tags}}<span class="method-tag">{{this}}</span>{{/tags}}</div>
|
||||
<div class="method-summary"><span class="nickname">{{nickname}}</span> {{summary}}</div>
|
||||
<div class="method-notes">{{notes}}</div>
|
||||
|
||||
|
@ -54,6 +54,7 @@ hr {
|
||||
|
||||
pre {
|
||||
padding: 10px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
pre.get {
|
||||
@ -134,3 +135,17 @@ code {
|
||||
.param-header {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.method-tags {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.method-tag {
|
||||
background: none repeat scroll 0% 0% #24A600;
|
||||
border-radius: 3px;
|
||||
padding: 2px 10px;
|
||||
margin: 2px;
|
||||
color: #FFF;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user