private FormParameter extractRequestPart(Type type, RequestPart requestPart) { String paramName = StringUtils.defaultIfEmpty(requestPart.value(), requestPart.name()); FormParameter formParameter = new FormParameter().name(paramName) .required(requestPart.required()); JavaType ct = constructType(type); Property schema; if (MultipartFile.class.isAssignableFrom(ct.getRawClass())) { schema = new FileProperty(); } else if (ct.isContainerType() && MultipartFile.class.isAssignableFrom(ct.getContentType().getRawClass())) { schema = new ArrayProperty().items(new FileProperty()); } else { schema = ModelConverters.getInstance().readAsProperty(type); } if (schema != null) { formParameter.setProperty(schema); } return formParameter; }
/** * Build a {@link FormParameter} Swagger object defined by {@link ApiImplicitParam} * to use for documentation. * * @param apiParam The annotation which documents the parameter. * @return The {@link FormParameter} object to be used in {@link Swagger} */ public static FormParameter formParameter(ApiImplicitParam apiParam) { return new FormParameter() .name(apiParam.name()) .description(apiParam.value()) .required(apiParam.required()) .type(apiParam.dataType()); }
.name(FORM_PARAM_NAME) .description(FORM_PARAM_VALUE) .required(false) .type(SwaggerDocumentation.DataTypes.DATA_TYPE_STRING);