-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I configured Swagger using BeanConfig
on my Application
start up to use pretty print, but when I retrieve the API from swagger.json
endpoint it's all on a single line.
I've tracked the issue down to the ApiListingResource. When this resource processes the API, it doesn't return a Swagger object on the Response (that would be then converted by SwaggerSerializers), but returns a text string instead.
If ApiListingResource
responds with the Swagger object instead, the serialization works fine and respect the pretty print request. Could the getListing()
code be changed from
if (StringUtils.isNotBlank(type) && type.trim().equalsIgnoreCase("yaml")) {
return getListingYamlResponse(app, context, sc, headers, uriInfo);
} else {
return getListingJsonResponse(app, context, sc, headers, uriInfo);
}
to
Swagger swagger = process(app, context, sc, headers, uriInfo);
if(swagger == null) {
return Response.status(Status.NOT_FOUND).build();
} else {
return Response.ok(swagger, "json".equals(type) ? MediaType.APPLICATION_JSON_TYPE : new MediaType("application", "yaml")).build();
}
or would it affect some functionality I'm not aware of?
Metadata
Metadata
Assignees
Labels
No labels