use of com.sun.jersey.multipart.FormDataParam in project swagger-core by swagger-api.
the class SwaggerJerseyJaxrs method extractParameters.
@Override
public List<Parameter> extractParameters(List<Annotation> annotations, Type type, Set<Type> typesToSkip, Iterator<SwaggerExtension> chain) {
if (shouldIgnoreType(type, typesToSkip)) {
// stop the processing chain
return Collections.emptyList();
}
for (Annotation annotation : annotations) {
if (annotation instanceof FormDataParam) {
final FormDataParam fd = (FormDataParam) annotation;
final Class<?> cls = TypeFactory.defaultInstance().constructType(type).getRawClass();
final Parameter param;
if (java.io.InputStream.class.isAssignableFrom(cls)) {
param = new FormParameter().type("file").name(fd.value());
} else {
FormParameter fp = new FormParameter().name(fd.value());
Property schema = ModelConverters.getInstance().readAsProperty(type);
if (schema != null) {
fp.setProperty(schema);
}
param = fp;
}
return Collections.singletonList(param);
}
}
return super.extractParameters(annotations, type, typesToSkip, chain);
}
Aggregations