use of io.swagger.annotations.ResponseHeader in project swagger-core by swagger-api.
the class ServletReaderExtension method parseResponseHeaders.
private static Map<String, Property> parseResponseHeaders(ReaderContext context, ResponseHeader[] headers) {
Map<String, Property> responseHeaders = null;
for (ResponseHeader header : headers) {
final String name = header.name();
if (StringUtils.isNotEmpty(name)) {
if (responseHeaders == null) {
responseHeaders = new HashMap<String, Property>();
}
final Class<?> cls = header.response();
if (!ReflectionUtils.isVoid(cls)) {
final Property property = ModelConverters.getInstance().readAsProperty(cls);
if (property != null) {
final Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET);
responseProperty.setDescription(header.description());
responseHeaders.put(name, responseProperty);
appendModels(context.getSwagger(), cls);
}
}
}
}
return responseHeaders;
}
use of io.swagger.annotations.ResponseHeader in project swagger-core by swagger-api.
the class Reader method parseResponseHeaders.
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) {
Map<String, Property> responseHeaders = null;
if (headers != null) {
for (ResponseHeader header : headers) {
String name = header.name();
if (!"".equals(name)) {
if (responseHeaders == null) {
responseHeaders = new LinkedHashMap<String, Property>();
}
String description = header.description();
Class<?> cls = header.response();
if (!isVoid(cls)) {
final Property property = ModelConverters.getInstance().readAsProperty(cls);
if (property != null) {
Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET);
responseProperty.setDescription(description);
responseHeaders.put(name, responseProperty);
appendModels(cls);
}
}
}
}
}
return responseHeaders;
}
use of io.swagger.annotations.ResponseHeader in project java-chassis by ServiceComb.
the class ResponseHeaderProcessor method process.
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
ResponseHeader responseHeader = (ResponseHeader) annotation;
ResponseHeaderConfig config = AnnotationUtils.convert(responseHeader);
if (config != null) {
Property property = AnnotationUtils.generateResponseHeaderProperty(operationGenerator.getSwagger(), config);
operationGenerator.addResponseHeader(config.getName(), property);
}
}
use of io.swagger.annotations.ResponseHeader in project java-chassis by ServiceComb.
the class ResponseHeadersProcessor method process.
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
ResponseHeaders responseHeaders = (ResponseHeaders) annotation;
MethodAnnotationProcessor processor = operationGenerator.getContext().findMethodAnnotationProcessor(ResponseHeader.class);
for (ResponseHeader responseHeader : responseHeaders.value()) {
processor.process(responseHeader, operationGenerator);
}
}
Aggregations