Skip to content

Commit

Permalink
fixes #118 openapi generator check if examples map is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Mar 17, 2018
1 parent 11635e3 commit 1921f81
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,12 @@ public List<Map<String, Object>> getOperationList(Object model) {
// check if there are multiple examples
Map<String, Example> exampleMap = mediaType.getExamples();
// use the first example if there are multiple
Map.Entry<String,Example> entry = exampleMap.entrySet().iterator().next();
Example e = entry.getValue();
if(e != null) {
flattened.put("example", e.getValue());
if(exampleMap.size() > 0) {
Map.Entry<String,Example> entry = exampleMap.entrySet().iterator().next();
Example e = entry.getValue();
if(e != null) {
flattened.put("example", e.getValue());
}
}
}
}
Expand Down

0 comments on commit 1921f81

Please sign in to comment.