io.sinistral.proteus.swagger.jaxrs2.ServerParameterExtension Maven / Gradle / Ivy
The newest version!
/**
*
*/
package io.sinistral.proteus.swagger.jaxrs2;
import com.fasterxml.jackson.databind.JavaType;
import io.swagger.jaxrs.DefaultParameterExtension;
import io.swagger.jaxrs.ext.SwaggerExtension;
import io.swagger.models.parameters.Parameter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/**
* @author jbauer
*
*/
public class ServerParameterExtension extends DefaultParameterExtension
{
public ServerParameterExtension()
{
super();
}
@Override
protected JavaType constructType(Type type)
{
if (type.getTypeName().contains("java.nio.ByteBuffer") || type.getTypeName().contains("java.nio.file.Path"))
{
type = java.io.File.class;
}
return super.constructType(type);
}
@Override
public List extractParameters(List annotations, Type type, Set typesToSkip, Iterator chain)
{
if (type.getTypeName().contains("java.nio.ByteBuffer") || type.getTypeName().contains("java.nio.file.Path"))
{
type = java.io.File.class;
}
return super.extractParameters(annotations, type, typesToSkip, chain);
}
@Override
protected boolean shouldIgnoreType(Type type, Set typesToSkip)
{
if (type.getTypeName().contains("io.sinistral.proteus.server.ServerRequest")
|| type.getTypeName().contains("HttpServerExchange")
|| type.getTypeName().contains("HttpHandler")
|| type.getTypeName().contains("io.sinistral.proteus.server.ServerResponse")
|| type.getTypeName().contains("io.undertow.server.session"))
{
return true;
}
return super.shouldIgnoreType(type, typesToSkip);
}
}