swagger-api / swagger-api/swagger-codegen
How to add RedirectAttributes through Swagger Documentation
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
We're using swagger codegen maven plugin. We have one Api which accepts multipart file. The signatures of the api code generated using the maven plugins are :-
default ResponseEntity<FileInfo> uploadFile(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file)
However what we would want will be an additional parameter with this being the RedirectAttributes from the class org.springframework.web.servlet.mvc.support.RedirectAttributes
Swagger-codegen version
2.3.1
Swagger declaration file content or url
/upload:
post:
tags:
- fileUpload
produces:
- application/json
consumes:
- multipart/form-data
operationId: uploadFile
parameters:
- in: formData
name: file
type: file
responses:
'200':
schema:
$ref: '#/definitions/file'
Is there a way we could achieve this using swagger-codegen-maven-plugin?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the swagger-codegen Maven plugin and the supplied Swagger declaration for the multipart /upload operation, then trace how its Java server signature is generated. Done means the generated uploadFile method includes an additional org.springframework.web.servlet.mvc.support.RedirectAttributes parameter while retaining the MultipartFile parameter and declared response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100