forked from loafle/openapi-generator-original
Merge pull request #401 from fleque/fleque-fix-response-selection
Fix for the selection of the methodResponse during code-generation
This commit is contained in:
commit
124e17fb8a
@ -4,6 +4,7 @@ import com.wordnik.swagger.models.*;
|
||||
import com.wordnik.swagger.models.parameters.*;
|
||||
import com.wordnik.swagger.models.properties.*;
|
||||
import com.wordnik.swagger.util.Json;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
@ -577,10 +578,12 @@ public class DefaultCodegen {
|
||||
}
|
||||
|
||||
if(operation.getResponses() != null) {
|
||||
for(String responseCode: operation.getResponses().keySet()) {
|
||||
for(String responseCode: new TreeSet<String>(operation.getResponses().keySet())) {
|
||||
Response response = operation.getResponses().get(responseCode);
|
||||
if("200".equals(responseCode)) {
|
||||
if (responseCode.startsWith("2")) {
|
||||
// use the first, i.e. the smallest 2xx response status as methodResponse
|
||||
methodResponse = response;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(methodResponse == null && operation.getResponses().keySet().contains("default")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user