'.xlsx file upload, swagger codegn does not generate @RequestParam for Multipartfile
I have to upload transactions stored in .xlsx file. I'm trying to generate api using swagger codegen. I have browsed through every stackoverflow thread regarding the problem, but found no solution.
I do have a contract:
/accounts/import/transactions:
post:
tags:
- Account Transaction
operationId: uploadTransactions
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
responses:
200:
description: 'Upload successful'
400:
...
swagger dependencies:
<springfox-swagger-ui>3.0.0</springfox-swagger-ui>
<springfox-swagger2>3.0.0</springfox-swagger2>
<swagger-codegen-maven-plugin>3.0.21</swagger-codegen-maven-plugin>
The API I get is missing @RequestParam("file") MultiPartFile file. Any idea what I'm doing wrong? Does this have anything to do with Swagger versions?
@RequestMapping(value = "/accounts/import/transactions",
produces = { "application/json" },
consumes = { "multipart/form-data" },
method = RequestMethod.POST)
default ResponseEntity<Void> uploadTransactions() {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default AccountsApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
