Skip to content

Commit

Permalink
Properly handle empty responses in OpenAPI.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Oct 22, 2018
1 parent 09a4f4c commit b7d5cf6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/io/sinistral/proteus/server/tools/oas/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1348,12 +1348,14 @@ else if (classType.getRawClass().isAssignableFrom(CompletableFuture.class))
}
if (operation.getResponses() == null || operation.getResponses().isEmpty())
{
Content content = new Content();
MediaType mediaType = new MediaType();
AnnotationsUtils.applyTypes(classProduces == null ? new String[0] : classProduces.value(),
methodProduces == null ? new String[0] : methodProduces.value(), content, mediaType);
LOGGER.debug("responses are null or empty");

//Content content = new Content();
//MediaType mediaType = new MediaType();
//AnnotationsUtils.applyTypes(classProduces == null ? new String[0] : classProduces.value(),
// methodProduces == null ? new String[0] : methodProduces.value(), content, mediaType);

ApiResponse apiResponseObject = new ApiResponse().description(DEFAULT_DESCRIPTION).content(content);
ApiResponse apiResponseObject = new ApiResponse().description(DEFAULT_DESCRIPTION);//.content(content);
operation.setResponses(new ApiResponses()._default(apiResponseObject));
}

Expand Down Expand Up @@ -1495,7 +1497,7 @@ private void setOperationObjectFromApiOperationAnnotation(
operation.setResponses(responses);
}
else
{
{
responses.forEach(operation.getResponses()::addApiResponse);
}
});
Expand Down

0 comments on commit b7d5cf6

Please sign in to comment.