Search in sources :

Example 1 with ResponseHeaderConfig

use of io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig in project java-chassis by ServiceComb.

the class AnnotationUtils method convert.

public static ResponseHeaderConfig convert(ResponseHeader responseHeader) {
    if (StringUtils.isEmpty(responseHeader.name())) {
        return null;
    }
    ResponseHeaderConfig config = new ResponseHeaderConfig();
    config.setName(responseHeader.name());
    config.setDescription(responseHeader.description());
    config.setResponseClass(responseHeader.response());
    config.setResponseContainer(responseHeader.responseContainer());
    return config;
}
Also used : ResponseHeaderConfig(io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig)

Example 2 with ResponseHeaderConfig

use of io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig 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);
    }
}
Also used : ResponseHeader(io.swagger.annotations.ResponseHeader) ResponseHeaderConfig(io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig) Property(io.swagger.models.properties.Property)

Example 3 with ResponseHeaderConfig

use of io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig in project java-chassis by ServiceComb.

the class AnnotationUtils method generateResponseHeader.

private static Map<String, Property> generateResponseHeader(Swagger swagger, List<ResponseHeaderConfig> responseHeaders) {
    Map<String, Property> headers = new HashMap<>();
    for (ResponseHeaderConfig config : responseHeaders) {
        Property property = generateResponseHeaderProperty(swagger, config);
        headers.put(config.getName(), property);
    }
    return headers;
}
Also used : ResponseHeaderConfig(io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayProperty(io.swagger.models.properties.ArrayProperty) Property(io.swagger.models.properties.Property) MapProperty(io.swagger.models.properties.MapProperty)

Aggregations

ResponseHeaderConfig (io.servicecomb.swagger.generator.core.processor.annotation.models.ResponseHeaderConfig)3 Property (io.swagger.models.properties.Property)2 ResponseHeader (io.swagger.annotations.ResponseHeader)1 ArrayProperty (io.swagger.models.properties.ArrayProperty)1 MapProperty (io.swagger.models.properties.MapProperty)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1