OpenAPITools / OpenAPITools/openapi-generator
[REQ] How to Support with spring boot ResponseBodyAdvice
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
@RestController("/hello")
public class HelloController {
@GetMapping
public String sayHello() {
return "hello";
}
}
And we used 'ResponseVO' generic class as unified response body like the following
public class ResponseVO {
private int status;
private String errorMessage;
private Object data;
}
After send GET HTTP request, it returns the following response
{
"status": 200,
"data": "hello"
}
But when use openapi-generator generate rest client api, it will generate
String sayHello();
When request with generated client api, it will complain can NOT parse String from json object.
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 HelloController, ResponseVO shape, and generated String sayHello() entry point described in the issue. Compare the declared response model with the JSON returned by the server, then inspect the generator path responsible for response types. Done means the generated client and the documented response shape agree and the returned object can be parsed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring-boot
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100